<html>
<head>
<script>
var $wnd = parent;
var $doc = $wnd.document;
var $moduleName = "index";
</script>

</head>
<body onload="if (parent && parent.__pygwt_webModeFrameOnLoad) parent.__pygwt_webModeFrameOnLoad(window, 'index');">
<font face='arial' size='-1'>This script is part of module</font> <code>index</code>



<script><!--


StopIteration = function () {};
StopIteration.prototype = new Error();
StopIteration.name = 'StopIteration';
StopIteration.message = 'StopIteration';

KeyError = function () {};
KeyError.prototype = new Error();
KeyError.name = 'KeyError';
KeyError.message = 'KeyError';

TypeError = function () {};
TypeError.prototype = new Error();
TypeError.name = "TypeError";
TypeError.message = "TypeError";

function pyjslib_String_find(sub, start, end) {
    var pos=this.indexOf(sub, start);
    if (pyjslib_isUndefined(end)) return pos;

    if (pos + sub.length>end) return -1;
    return pos;
}
    
function pyjslib_String_join(data) {
    var text="";
    
    if (pyjslib_isArray(data)) {
        return data.join(this);
    }
    else if (pyjslib_isIteratable(data)) {
        var iter=data.__iter__();
        try {
            text+=iter.next();
            while (true) {
                var item=iter.next();
                text+=this + item;
            }
        }
        catch (e) {
            if (e != StopIteration) throw e;
        }
    }

    return text;
}

function pyjslib_String_replace(old, replace, count) {
    var do_max=false;
    var start=0;
    var new_str="";
    var pos=0;
    
    if (!pyjslib_isString(old)) return this.__replace(old, replace);
    if (!pyjslib_isUndefined(count)) do_max=true;
    
    while (start<this.length) {
        if (do_max && !count--) break;
        
        pos=this.indexOf(old, start);
        if (pos<0) break;
        
        new_str+=this.substring(start, pos) + replace;
        start=pos+old.length;
    }
    if (start<this.length) new_str+=this.substring(start);

    return new_str;
}

function pyjslib_String_split(sep, maxsplit) {
    var items=new pyjslib_List();
    var do_max=false;
    var subject=this;
    var start=0;
    var pos=0;
    
    if (pyjslib_isUndefined(sep) || pyjslib_isNull(sep)) {
        sep=" ";
        subject=subject.strip();
        subject=subject.replace(/\s+/g, sep);
    }
    else if (!pyjslib_isUndefined(maxsplit)) do_max=true;

    while (start<subject.length) {
        if (do_max && !maxsplit--) break;
    
        pos=subject.indexOf(sep, start);
        if (pos<0) break;
        
        items.append(subject.substring(start, pos));
        start=pos+sep.length;
    }
    if (start<subject.length) items.append(subject.substring(start));
    
    return items;
}

function pyjslib_String_strip(chars) {
    return this.lstrip(chars).rstrip(chars);
}

function pyjslib_String_lstrip(chars) {
    if (pyjslib_isUndefined(chars)) return this.replace(/^\s+/, "");

    return this.replace(new RegExp("^[" + chars + "]+"), "");
}

function pyjslib_String_rstrip(chars) {
    if (pyjslib_isUndefined(chars)) return this.replace(/\s+$/, "");

    return this.replace(new RegExp("[" + chars + "]+$"), "");
}

function pyjslib_String_startswith(prefix, start) {
    if (pyjslib_isUndefined(start)) start = 0;

    if (this.substring(start, prefix.length) == prefix) return true;
    return false;
}

String.prototype.__getitem__ = String.prototype.charAt;
String.prototype.upper = String.prototype.toUpperCase;
String.prototype.lower = String.prototype.toLowerCase;
String.prototype.find=pyjslib_String_find;
String.prototype.join=pyjslib_String_join;

String.prototype.__replace=String.prototype.replace;
String.prototype.replace=pyjslib_String_replace;

String.prototype.split=pyjslib_String_split;
String.prototype.strip=pyjslib_String_strip;
String.prototype.lstrip=pyjslib_String_lstrip;
String.prototype.rstrip=pyjslib_String_rstrip;
String.prototype.startswith=pyjslib_String_startswith;

var str = String;

var pyjslib_abs = Math.abs;

function pyjs_extend(klass, base) {
    function klass_object_inherit() {}
    klass_object_inherit.prototype = base.prototype;
    klass_object = new klass_object_inherit();
    for (var i in base.prototype.__class__) {
        v = base.prototype.__class__[i];
        if (typeof v == "function" && (v.class_method || v.static_method || v.unbound_method))
        {
            klass_object[i] = v;
        }
    }
    
    function klass_inherit() {}
    klass_inherit.prototype = klass_object;
    klass.prototype = new klass_inherit();
    klass_object.constructor = klass;
    klass.prototype.__class__ = klass_object;
    
    for (var i in base.prototype) {
        v = base.prototype[i];
        if (typeof v == "function" && v.instance_method)
        {
            klass.prototype[i] = v;
        }
    }
}

function pyjs_kwargs_function_call(func, args)
{
    return func.apply(null, func.parse_kwargs.apply(null, args));
}

function pyjs_kwargs_method_call(obj, method_name, args)
{
    var method = obj[method_name];
    return method.apply(obj, method.parse_kwargs.apply(null, args));
}


function __pyjslib_Object() {
}
function pyjslib_Object() {
    var instance = new __pyjslib_Object();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __pyjslib_Object_initialize() {
    if(__pyjslib_Object.__was_initialized__) return;
    __pyjslib_Object.__was_initialized__ = true;
    __pyjslib_Object.prototype.__class__ = {};
    __pyjslib_Object.prototype.__class__.__new__ = pyjslib_Object;
}
function __pyjslib_Class() {
}
function pyjslib_Class(name) {
    var instance = new __pyjslib_Class();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __pyjslib_Class_initialize() {
    if(__pyjslib_Class.__was_initialized__) return;
    __pyjslib_Class.__was_initialized__ = true;
    pyjs_extend(__pyjslib_Class, __pyjslib_Object);
    __pyjslib_Class.prototype.__class__.__new__ = pyjslib_Class;
    __pyjslib_Class.prototype.__init__ = function(name) {
    this.name = name;
    };
    __pyjslib_Class.prototype.__class__.__init__ = function() {
        return __pyjslib_Class.prototype.__init__.call.apply(__pyjslib_Class.prototype.__init__, arguments);
    };
    __pyjslib_Class.prototype.__class__.__init__.unbound_method = true;
    __pyjslib_Class.prototype.__init__.instance_method = true;
    __pyjslib_Class.prototype.__str___ = function() {
    return this.name;
    };
    __pyjslib_Class.prototype.__class__.__str___ = function() {
        return __pyjslib_Class.prototype.__str___.call.apply(__pyjslib_Class.prototype.__str___, arguments);
    };
    __pyjslib_Class.prototype.__class__.__str___.unbound_method = true;
    __pyjslib_Class.prototype.__str___.instance_method = true;
}
function pyjslib_cmp(a, b) {
    if (pyjslib_hasattr(a, '__cmp__')) {
    return a.__cmp__(b);
    }
    else if (pyjslib_hasattr(a, '__cmp__')) {
    return -b.__cmp__(a);
    }
    if ((a > b)) {
    return 1;
    }
    else if ((b > a)) {
    return -1;
    }
    else {
    return 0;
    }
}


function __pyjslib_List() {
}
function pyjslib_List(data) {
    if (typeof data == 'undefined') data=null;
    var instance = new __pyjslib_List();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


pyjslib_List.parse_kwargs = function ( __kwargs, data ) {
    if (typeof data == 'undefined')
        data=__kwargs.data;
    var __r = [data];
    return __r;
};
function __pyjslib_List_initialize() {
    if(__pyjslib_List.__was_initialized__) return;
    __pyjslib_List.__was_initialized__ = true;
    pyjs_extend(__pyjslib_List, __pyjslib_Object);
    __pyjslib_List.prototype.__class__.__new__ = pyjslib_List;
    __pyjslib_List.prototype.__init__ = function(data) {
    if (typeof data == 'undefined') data=null;

        this.l = [];
        
        if (pyjslib_isArray(data)) {
            for (var i=0; i < data.length; i++) {
                this.l[i]=data[i];
                }
            }
        else if (pyjslib_isIteratable(data)) {
            var iter=data.__iter__();
            var i=0;
            try {
                while (true) {
                    var item=iter.next();
                    this.l[i++]=item;
                    }
                }
            catch (e) {
                if (e != StopIteration) throw e;
                }
            }
        
    };
__pyjslib_List.prototype.__init__.parse_kwargs = function ( __kwargs, data ) {
    if (typeof data == 'undefined')
        data=__kwargs.data;
    var __r = [data];
    return __r;
};
    __pyjslib_List.prototype.__class__.__init__ = function() {
        return __pyjslib_List.prototype.__init__.call.apply(__pyjslib_List.prototype.__init__, arguments);
    };
    __pyjslib_List.prototype.__class__.__init__.unbound_method = true;
    __pyjslib_List.prototype.__init__.instance_method = true;
    __pyjslib_List.prototype.__class__.__init__.parse_kwargs = __pyjslib_List.prototype.__init__.parse_kwargs;
    __pyjslib_List.prototype.append = function(item) {
    this.l[this.l.length] = item;
    };
    __pyjslib_List.prototype.__class__.append = function() {
        return __pyjslib_List.prototype.append.call.apply(__pyjslib_List.prototype.append, arguments);
    };
    __pyjslib_List.prototype.__class__.append.unbound_method = true;
    __pyjslib_List.prototype.append.instance_method = true;
    __pyjslib_List.prototype.remove = function(value) {

        var index=this.index(value);
        if (index<0) return false;
        this.l.splice(index, 1);
        return true;
        
    };
    __pyjslib_List.prototype.__class__.remove = function() {
        return __pyjslib_List.prototype.remove.call.apply(__pyjslib_List.prototype.remove, arguments);
    };
    __pyjslib_List.prototype.__class__.remove.unbound_method = true;
    __pyjslib_List.prototype.remove.instance_method = true;
    __pyjslib_List.prototype.index = function(value, start) {
    if (typeof start == 'undefined') start=0;

        var length=this.l.length;
        for (var i=start; i<length; i++) {
            if (this.l[i]==value) {
                return i;
                }
            }
        return -1;
        
    };
__pyjslib_List.prototype.index.parse_kwargs = function ( __kwargs, value, start ) {
    if (typeof start == 'undefined')
        start=__kwargs.start;
    var __r = [value, start];
    return __r;
};
    __pyjslib_List.prototype.__class__.index = function() {
        return __pyjslib_List.prototype.index.call.apply(__pyjslib_List.prototype.index, arguments);
    };
    __pyjslib_List.prototype.__class__.index.unbound_method = true;
    __pyjslib_List.prototype.index.instance_method = true;
    __pyjslib_List.prototype.__class__.index.parse_kwargs = __pyjslib_List.prototype.index.parse_kwargs;
    __pyjslib_List.prototype.insert = function(index, value) {
    var a = this.l; this.l=a.slice(0, index).concat(value, a.slice(index));
    };
    __pyjslib_List.prototype.__class__.insert = function() {
        return __pyjslib_List.prototype.insert.call.apply(__pyjslib_List.prototype.insert, arguments);
    };
    __pyjslib_List.prototype.__class__.insert.unbound_method = true;
    __pyjslib_List.prototype.insert.instance_method = true;
    __pyjslib_List.prototype.pop = function(index) {
    if (typeof index == 'undefined') index=-1;

        if (index<0) index = this.l.length + index;
        var a = this.l[index];
        this.l.splice(index, 1);
        return a;
        
    };
__pyjslib_List.prototype.pop.parse_kwargs = function ( __kwargs, index ) {
    if (typeof index == 'undefined')
        index=__kwargs.index;
    var __r = [index];
    return __r;
};
    __pyjslib_List.prototype.__class__.pop = function() {
        return __pyjslib_List.prototype.pop.call.apply(__pyjslib_List.prototype.pop, arguments);
    };
    __pyjslib_List.prototype.__class__.pop.unbound_method = true;
    __pyjslib_List.prototype.pop.instance_method = true;
    __pyjslib_List.prototype.__class__.pop.parse_kwargs = __pyjslib_List.prototype.pop.parse_kwargs;
    __pyjslib_List.prototype.slice = function(lower, upper) {

        if (upper==null) return pyjslib_List(this.l.slice(lower));
        return pyjslib_List(this.l.slice(lower, upper));
        
    };
    __pyjslib_List.prototype.__class__.slice = function() {
        return __pyjslib_List.prototype.slice.call.apply(__pyjslib_List.prototype.slice, arguments);
    };
    __pyjslib_List.prototype.__class__.slice.unbound_method = true;
    __pyjslib_List.prototype.slice.instance_method = true;
    __pyjslib_List.prototype.__getitem__ = function(index) {

        if (index<0) index = this.l.length + index;
        return this.l[index];
        
    };
    __pyjslib_List.prototype.__class__.__getitem__ = function() {
        return __pyjslib_List.prototype.__getitem__.call.apply(__pyjslib_List.prototype.__getitem__, arguments);
    };
    __pyjslib_List.prototype.__class__.__getitem__.unbound_method = true;
    __pyjslib_List.prototype.__getitem__.instance_method = true;
    __pyjslib_List.prototype.__setitem__ = function(index, value) {
    this.l[index]=value;
    };
    __pyjslib_List.prototype.__class__.__setitem__ = function() {
        return __pyjslib_List.prototype.__setitem__.call.apply(__pyjslib_List.prototype.__setitem__, arguments);
    };
    __pyjslib_List.prototype.__class__.__setitem__.unbound_method = true;
    __pyjslib_List.prototype.__setitem__.instance_method = true;
    __pyjslib_List.prototype.__delitem__ = function(index) {
    this.l.splice(index, 1);
    };
    __pyjslib_List.prototype.__class__.__delitem__ = function() {
        return __pyjslib_List.prototype.__delitem__.call.apply(__pyjslib_List.prototype.__delitem__, arguments);
    };
    __pyjslib_List.prototype.__class__.__delitem__.unbound_method = true;
    __pyjslib_List.prototype.__delitem__.instance_method = true;
    __pyjslib_List.prototype.__len__ = function() {
    return this.l.length;
    };
    __pyjslib_List.prototype.__class__.__len__ = function() {
        return __pyjslib_List.prototype.__len__.call.apply(__pyjslib_List.prototype.__len__, arguments);
    };
    __pyjslib_List.prototype.__class__.__len__.unbound_method = true;
    __pyjslib_List.prototype.__len__.instance_method = true;
    __pyjslib_List.prototype.__contains__ = function(value) {
    return (this.index(value) >= 0);
    };
    __pyjslib_List.prototype.__class__.__contains__ = function() {
        return __pyjslib_List.prototype.__contains__.call.apply(__pyjslib_List.prototype.__contains__, arguments);
    };
    __pyjslib_List.prototype.__class__.__contains__.unbound_method = true;
    __pyjslib_List.prototype.__contains__.instance_method = true;
    __pyjslib_List.prototype.__iter__ = function() {

        var i = 0;
        var l = this.l;
        
        return {
            'next': function() {
                if (i >= l.length) {
                    throw StopIteration;
                }
                return l[i++];
            },
            '__iter__': function() {
                return this;
            }
        };
        
    };
    __pyjslib_List.prototype.__class__.__iter__ = function() {
        return __pyjslib_List.prototype.__iter__.call.apply(__pyjslib_List.prototype.__iter__, arguments);
    };
    __pyjslib_List.prototype.__class__.__iter__.unbound_method = true;
    __pyjslib_List.prototype.__iter__.instance_method = true;
    __pyjslib_List.prototype.sort = function(compareFunc, keyFunc, reverse) {
    if (typeof compareFunc == 'undefined') compareFunc=null;
    if (typeof keyFunc == 'undefined') keyFunc=null;
    if (typeof reverse == 'undefined') reverse=false;
    if (!(compareFunc)) {
    var compareFunc = pyjslib_cmp;
    }
    if ((keyFunc) && (reverse)) {
function thisSort1(a, b) {
    return -compareFunc(keyFunc(a), keyFunc(b));
}


    this.l.sort(thisSort1);
    }
    else if (keyFunc) {
function thisSort2(a, b) {
    return compareFunc(keyFunc(a), keyFunc(b));
}


    this.l.sort(thisSort2);
    }
    else if (reverse) {
function thisSort3(a, b) {
    return -compareFunc(a, b);
}


    this.l.sort(thisSort3);
    }
    else {
    this.l.sort(compareFunc);
    }
    };
__pyjslib_List.prototype.sort.parse_kwargs = function ( __kwargs, compareFunc, keyFunc, reverse ) {
    if (typeof compareFunc == 'undefined')
        compareFunc=__kwargs.compareFunc;
    if (typeof keyFunc == 'undefined')
        keyFunc=__kwargs.keyFunc;
    if (typeof reverse == 'undefined')
        reverse=__kwargs.reverse;
    var __r = [compareFunc, keyFunc, reverse];
    return __r;
};
    __pyjslib_List.prototype.__class__.sort = function() {
        return __pyjslib_List.prototype.sort.call.apply(__pyjslib_List.prototype.sort, arguments);
    };
    __pyjslib_List.prototype.__class__.sort.unbound_method = true;
    __pyjslib_List.prototype.sort.instance_method = true;
    __pyjslib_List.prototype.__class__.sort.parse_kwargs = __pyjslib_List.prototype.sort.parse_kwargs;
    __pyjslib_List.prototype.getArray = function() {
    return this.l;
    };
    __pyjslib_List.prototype.__class__.getArray = function() {
        return __pyjslib_List.prototype.getArray.call.apply(__pyjslib_List.prototype.getArray, arguments);
    };
    __pyjslib_List.prototype.__class__.getArray.unbound_method = true;
    __pyjslib_List.prototype.getArray.instance_method = true;
}
    var pyjslib_list = __pyjslib_List.prototype.__class__;
function __pyjslib_Tuple() {
}
function pyjslib_Tuple(data) {
    var instance = new __pyjslib_Tuple();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __pyjslib_Tuple_initialize() {
    if(__pyjslib_Tuple.__was_initialized__) return;
    __pyjslib_Tuple.__was_initialized__ = true;
    if(!__pyjslib_List.__was_initialized__)
        __pyjslib_List_initialize();
    pyjs_extend(__pyjslib_Tuple, __pyjslib_List);
    __pyjslib_Tuple.prototype.__class__.__new__ = pyjslib_Tuple;
    __pyjslib_Tuple.prototype.__init__ = function(data) {
    __pyjslib_List.prototype.__class__.__init__(this, data);
    };
    __pyjslib_Tuple.prototype.__class__.__init__ = function() {
        return __pyjslib_Tuple.prototype.__init__.call.apply(__pyjslib_Tuple.prototype.__init__, arguments);
    };
    __pyjslib_Tuple.prototype.__class__.__init__.unbound_method = true;
    __pyjslib_Tuple.prototype.__init__.instance_method = true;
}
    var pyjslib_tuple = __pyjslib_Tuple.prototype.__class__;
function __pyjslib_Dict() {
}
function pyjslib_Dict(data) {
    if (typeof data == 'undefined') data=null;
    var instance = new __pyjslib_Dict();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


pyjslib_Dict.parse_kwargs = function ( __kwargs, data ) {
    if (typeof data == 'undefined')
        data=__kwargs.data;
    var __r = [data];
    return __r;
};
function __pyjslib_Dict_initialize() {
    if(__pyjslib_Dict.__was_initialized__) return;
    __pyjslib_Dict.__was_initialized__ = true;
    pyjs_extend(__pyjslib_Dict, __pyjslib_Object);
    __pyjslib_Dict.prototype.__class__.__new__ = pyjslib_Dict;
    __pyjslib_Dict.prototype.__init__ = function(data) {
    if (typeof data == 'undefined') data=null;

        this.d = {};

        if (pyjslib_isArray(data)) {
            for (var i in data) {
                var item=data[i];
                var sKey=this._keyToStr(item[0]);
                this.d[sKey]=item[1];
                }
            }
        else if (pyjslib_isIteratable(data)) {
            var iter=data.__iter__();
            try {
                while (true) {
                    var item=iter.next();
                    var sKey=this._keyToStr(item.__getitem__(0));
                    this.d[sKey]=item.__getitem__(1);
                    }
                }
            catch (e) {
                if (e != StopIteration) throw e;
                }
            }
        else if (pyjslib_isObject(data)) {
            for (var key in data) {
                this.d[key]=data[key];
                }
            }
        
    };
__pyjslib_Dict.prototype.__init__.parse_kwargs = function ( __kwargs, data ) {
    if (typeof data == 'undefined')
        data=__kwargs.data;
    var __r = [data];
    return __r;
};
    __pyjslib_Dict.prototype.__class__.__init__ = function() {
        return __pyjslib_Dict.prototype.__init__.call.apply(__pyjslib_Dict.prototype.__init__, arguments);
    };
    __pyjslib_Dict.prototype.__class__.__init__.unbound_method = true;
    __pyjslib_Dict.prototype.__init__.instance_method = true;
    __pyjslib_Dict.prototype.__class__.__init__.parse_kwargs = __pyjslib_Dict.prototype.__init__.parse_kwargs;
    __pyjslib_Dict.prototype.__setitem__ = function(key, value) {

        var sKey = this._keyToStr(key);
        this.d[sKey]=value;
        
    };
    __pyjslib_Dict.prototype.__class__.__setitem__ = function() {
        return __pyjslib_Dict.prototype.__setitem__.call.apply(__pyjslib_Dict.prototype.__setitem__, arguments);
    };
    __pyjslib_Dict.prototype.__class__.__setitem__.unbound_method = true;
    __pyjslib_Dict.prototype.__setitem__.instance_method = true;
    __pyjslib_Dict.prototype.__getitem__ = function(key) {

        var sKey = this._keyToStr(key);
        var value=this.d[sKey];
        // if (pyjslib_isUndefined(value)) throw KeyError;
        return value;
        
    };
    __pyjslib_Dict.prototype.__class__.__getitem__ = function() {
        return __pyjslib_Dict.prototype.__getitem__.call.apply(__pyjslib_Dict.prototype.__getitem__, arguments);
    };
    __pyjslib_Dict.prototype.__class__.__getitem__.unbound_method = true;
    __pyjslib_Dict.prototype.__getitem__.instance_method = true;
    __pyjslib_Dict.prototype.__len__ = function() {

        var size=0;
        for (var i in this.d) size++;
        return size;
        
    };
    __pyjslib_Dict.prototype.__class__.__len__ = function() {
        return __pyjslib_Dict.prototype.__len__.call.apply(__pyjslib_Dict.prototype.__len__, arguments);
    };
    __pyjslib_Dict.prototype.__class__.__len__.unbound_method = true;
    __pyjslib_Dict.prototype.__len__.instance_method = true;
    __pyjslib_Dict.prototype.has_key = function(key) {

        var sKey = this._keyToStr(key);
        if (pyjslib_isUndefined(this.d[sKey])) return false;
        return true;
        
    };
    __pyjslib_Dict.prototype.__class__.has_key = function() {
        return __pyjslib_Dict.prototype.has_key.call.apply(__pyjslib_Dict.prototype.has_key, arguments);
    };
    __pyjslib_Dict.prototype.__class__.has_key.unbound_method = true;
    __pyjslib_Dict.prototype.has_key.instance_method = true;
    __pyjslib_Dict.prototype.__delitem__ = function(key) {

        var sKey = this._keyToStr(key);
        delete this.d[sKey];
        
    };
    __pyjslib_Dict.prototype.__class__.__delitem__ = function() {
        return __pyjslib_Dict.prototype.__delitem__.call.apply(__pyjslib_Dict.prototype.__delitem__, arguments);
    };
    __pyjslib_Dict.prototype.__class__.__delitem__.unbound_method = true;
    __pyjslib_Dict.prototype.__delitem__.instance_method = true;
    __pyjslib_Dict.prototype.__contains__ = function(key) {

        var sKey = this._keyToStr(key);
        return (pyjslib_isUndefined(this.d[sKey])) ? false : true;
        
    };
    __pyjslib_Dict.prototype.__class__.__contains__ = function() {
        return __pyjslib_Dict.prototype.__contains__.call.apply(__pyjslib_Dict.prototype.__contains__, arguments);
    };
    __pyjslib_Dict.prototype.__class__.__contains__.unbound_method = true;
    __pyjslib_Dict.prototype.__contains__.instance_method = true;
    __pyjslib_Dict.prototype.keys = function() {

        var keys=new pyjslib_List();
        for (var key in this.d) keys.append(key);
        return keys;
        
    };
    __pyjslib_Dict.prototype.__class__.keys = function() {
        return __pyjslib_Dict.prototype.keys.call.apply(__pyjslib_Dict.prototype.keys, arguments);
    };
    __pyjslib_Dict.prototype.__class__.keys.unbound_method = true;
    __pyjslib_Dict.prototype.keys.instance_method = true;
    __pyjslib_Dict.prototype.values = function() {

        var keys=new pyjslib_List();
        for (var key in this.d) keys.append(this.d[key]);
        return keys;
        
    };
    __pyjslib_Dict.prototype.__class__.values = function() {
        return __pyjslib_Dict.prototype.values.call.apply(__pyjslib_Dict.prototype.values, arguments);
    };
    __pyjslib_Dict.prototype.__class__.values.unbound_method = true;
    __pyjslib_Dict.prototype.values.instance_method = true;
    __pyjslib_Dict.prototype.items = function() {

        var items = new pyjslib_List();
        for (var key in this.d) {
          var value = this.d[key];
          items.append(new pyjslib_List([key, value]))
          }
          return items;
        
    };
    __pyjslib_Dict.prototype.__class__.items = function() {
        return __pyjslib_Dict.prototype.items.call.apply(__pyjslib_Dict.prototype.items, arguments);
    };
    __pyjslib_Dict.prototype.__class__.items.unbound_method = true;
    __pyjslib_Dict.prototype.items.instance_method = true;
    __pyjslib_Dict.prototype.__iter__ = function() {

        return this.keys().__iter__();
        
    };
    __pyjslib_Dict.prototype.__class__.__iter__ = function() {
        return __pyjslib_Dict.prototype.__iter__.call.apply(__pyjslib_Dict.prototype.__iter__, arguments);
    };
    __pyjslib_Dict.prototype.__class__.__iter__.unbound_method = true;
    __pyjslib_Dict.prototype.__iter__.instance_method = true;
    __pyjslib_Dict.prototype.iterkeys = function() {

        return this.keys().__iter__();
        
    };
    __pyjslib_Dict.prototype.__class__.iterkeys = function() {
        return __pyjslib_Dict.prototype.iterkeys.call.apply(__pyjslib_Dict.prototype.iterkeys, arguments);
    };
    __pyjslib_Dict.prototype.__class__.iterkeys.unbound_method = true;
    __pyjslib_Dict.prototype.iterkeys.instance_method = true;
    __pyjslib_Dict.prototype.itervalues = function() {

        return this.values().__iter__();
        
    };
    __pyjslib_Dict.prototype.__class__.itervalues = function() {
        return __pyjslib_Dict.prototype.itervalues.call.apply(__pyjslib_Dict.prototype.itervalues, arguments);
    };
    __pyjslib_Dict.prototype.__class__.itervalues.unbound_method = true;
    __pyjslib_Dict.prototype.itervalues.instance_method = true;
    __pyjslib_Dict.prototype.iteritems = function() {

        var d = this.d;
        var iter=this.keys().__iter__();
        
        return {
            '__iter__': function() {
                return this;
            },

            'next': function() {
                var key;
                while (key=iter.next()) {
                    var item=new pyjslib_List();
                    item.append(key);
                    item.append(d[key]);
                    return item;
                }
            }
        };
        
    };
    __pyjslib_Dict.prototype.__class__.iteritems = function() {
        return __pyjslib_Dict.prototype.iteritems.call.apply(__pyjslib_Dict.prototype.iteritems, arguments);
    };
    __pyjslib_Dict.prototype.__class__.iteritems.unbound_method = true;
    __pyjslib_Dict.prototype.iteritems.instance_method = true;
    __pyjslib_Dict.prototype.setdefault = function(key, default_value) {
    var sKey = this._keyToStr(key);
    if (!(this.has_key(sKey))) {
    this.__setitem__(sKey, default_value);
    }
    };
    __pyjslib_Dict.prototype.__class__.setdefault = function() {
        return __pyjslib_Dict.prototype.setdefault.call.apply(__pyjslib_Dict.prototype.setdefault, arguments);
    };
    __pyjslib_Dict.prototype.__class__.setdefault.unbound_method = true;
    __pyjslib_Dict.prototype.setdefault.instance_method = true;
    __pyjslib_Dict.prototype.get = function(key, default_value) {
    if (typeof default_value == 'undefined') default_value=null;
    var sKey = this._keyToStr(key);
    var value = this.__getitem__(sKey);
if(pyjslib_isUndefined(value)) { value = default_value; }
    return value;
    };
__pyjslib_Dict.prototype.get.parse_kwargs = function ( __kwargs, key, default_value ) {
    if (typeof default_value == 'undefined')
        default_value=__kwargs.default_value;
    var __r = [key, default_value];
    return __r;
};
    __pyjslib_Dict.prototype.__class__.get = function() {
        return __pyjslib_Dict.prototype.get.call.apply(__pyjslib_Dict.prototype.get, arguments);
    };
    __pyjslib_Dict.prototype.__class__.get.unbound_method = true;
    __pyjslib_Dict.prototype.get.instance_method = true;
    __pyjslib_Dict.prototype.__class__.get.parse_kwargs = __pyjslib_Dict.prototype.get.parse_kwargs;
    __pyjslib_Dict.prototype.update = function(d) {

        var __temp_k = d.iteritems().__iter__();
        try {
            while (true) {
                var temp_k = __temp_k.next();
                
                var k = temp_k.__getitem__(0);
                
                var v = temp_k.__getitem__(1);
                
        
    this.__setitem__(k, v);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __pyjslib_Dict.prototype.__class__.update = function() {
        return __pyjslib_Dict.prototype.update.call.apply(__pyjslib_Dict.prototype.update, arguments);
    };
    __pyjslib_Dict.prototype.__class__.update.unbound_method = true;
    __pyjslib_Dict.prototype.update.instance_method = true;
    __pyjslib_Dict.prototype.getObject = function() {
    return this.d;
    };
    __pyjslib_Dict.prototype.__class__.getObject = function() {
        return __pyjslib_Dict.prototype.getObject.call.apply(__pyjslib_Dict.prototype.getObject, arguments);
    };
    __pyjslib_Dict.prototype.__class__.getObject.unbound_method = true;
    __pyjslib_Dict.prototype.getObject.instance_method = true;
    __pyjslib_Dict.prototype._keyToStr = function(key) {
    if ((pyjslib_isString(key)) || (pyjslib_isNumber(key))) {
    return key;
    }
    else {
    return pyjslib_repr(key);
    }
    };
    __pyjslib_Dict.prototype.__class__._keyToStr = function() {
        return __pyjslib_Dict.prototype._keyToStr.call.apply(__pyjslib_Dict.prototype._keyToStr, arguments);
    };
    __pyjslib_Dict.prototype.__class__._keyToStr.unbound_method = true;
    __pyjslib_Dict.prototype._keyToStr.instance_method = true;
}
    var pyjslib_dict = __pyjslib_Dict.prototype.__class__;
function pyjslib_range() {

    var start = 0;
    var stop = 0;
    var step = 1;

    if (arguments.length == 2) {
        start = arguments[0];
        stop = arguments[1];
        }
    else if (arguments.length == 3) {
        start = arguments[0];
        stop = arguments[1];
        step = arguments[2];
        }
    else if (arguments.length>0) stop = arguments[0];

    return {
        'next': function() {
            if ((step > 0 && start >= stop) || (step < 0 && start <= stop)) throw StopIteration;
            var rval = start;
            start += step;
            return rval;
            },
        '__iter__': function() {
            return this;
            }
        }
    
}


function pyjslib_slice(object, lower, upper) {

    if (pyjslib_isString(object)) {
        if (lower < 0) {
           lower = object.length + lower;
        }
        if (upper < 0) {
           upper = object.length + upper;
        }
        if (pyjslib_isNull(upper)) upper=object.length;
        return object.substring(lower, upper);
    }
    if (pyjslib_isObject(object) && object.slice)
        return object.slice(lower, upper);
    
    return null;
    
}


function pyjslib_str(text) {

    return String(text);
    
}


function pyjslib_ord(x) {
    if ((pyjslib_isString(x)) && ((pyjslib_len(x) == 1))) {

            return x.charCodeAt(0);
        
    }
    else {

            throw TypeError;
        
    }
    return;
}


function pyjslib_chr(x) {

        return String.fromCharCode(x)
    
}


function pyjslib_is_basetype(x) {

       var t = typeof(x);
       return t == 'boolean' ||
       t == 'function' ||
       t == 'number' ||
       t == 'string' ||
       t == 'undefined'
       ;
    
}


function pyjslib_get_pyjs_classtype(x) {

       if (pyjslib_hasattr(x, "__class__"))
           if (pyjslib_hasattr(x.__class__, "__new__"))
               var src = x.__class__.__new__.toString();
               return src.match(/function (\w*)/)[1];
       return null;
    
}


function pyjslib_repr(x) {

       if (x === null)
           return "null";

       if (x === undefined)
           return "undefined";

       var t = typeof(x);

       if (t == "boolean")
           return x.toString();

       if (t == "function")
           return "<function " + x.toString() + ">";

       if (t == "number")
           return x.toString();

       if (t == "string") {
           if (x.indexOf('"') == -1)
               return '"' + x + '"';
           if (x.indexOf("'") == -1)
               return "'" + x + "'";
           var s = x.replace(new RegExp('"', "g"), '\\"');
           return '"' + s + '"';
       };

       if (t == "undefined")
           return "undefined";

       // If we get here, x is an object.  See if it's a Pyjamas class.

       if (!pyjslib_hasattr(x, "__init__"))
           return "<" + x.toString() + ">";

       // Handle the common Pyjamas data types.

       var constructor = "UNKNOWN";

       constructor = pyjslib_get_pyjs_classtype(x);

       if (constructor == "pyjslib_Tuple") {
           var contents = x.getArray();
           var s = "(";
           for (var i=0; i < contents.length; i++) {
               s += pyjslib_repr(contents[i]);
               if (i < contents.length - 1)
                   s += ", ";
           };
           s += ")"
           return s;
       };

       if (constructor == "pyjslib_List") {
           var contents = x.getArray();
           var s = "[";
           for (var i=0; i < contents.length; i++) {
               s += pyjslib_repr(contents[i]);
               if (i < contents.length - 1)
                   s += ", ";
           };
           s += "]"
           return s;
       };

       if (constructor == "pyjslib_Dict") {
           var keys = new Array();
           for (var key in x.d)
               keys.push(key);

           var s = "{";
           for (var i=0; i<keys.length; i++) {
               var key = keys[i]
               s += pyjslib_repr(key) + ": " + pyjslib_repr(x.d[key]);
               if (i < keys.length-1)
                   s += ", "
           };
           s += "}";
           return s;
       };

       // If we get here, the class isn't one we know -> return the class name.
       // Note that we replace underscores with dots so that the name will
       // (hopefully!) look like the original Python name.

       var s = constructor.replace(new RegExp('_', "g"), '.');
       return "<" + s + " object>";
    
}


function pyjslib_int(text, radix) {
    if (typeof radix == 'undefined') radix=0;

    return parseInt(text, radix);
    
}


pyjslib_int.parse_kwargs = function ( __kwargs, text, radix ) {
    if (typeof radix == 'undefined')
        radix=__kwargs.radix;
    var __r = [text, radix];
    return __r;
};
function pyjslib_len(object) {

    if (object==null) return 0;
    if (pyjslib_isObject(object) && object.__len__) return object.__len__();
    return object.length;
    
}


function pyjslib_getattr(obj, method) {

    if (!pyjslib_isObject(obj)) return null;
    if (!pyjslib_isFunction(obj[method])) return obj[method];

    return function() {
        var args = [];
        for (var i = 0; i < arguments.length; i++) {
          args.push(arguments[i]);
        }
        obj[method].apply(obj,args);
        }
    
}


function pyjslib_hasattr(obj, method) {

    if (!pyjslib_isObject(obj)) return false;
    if (pyjslib_isUndefined(obj[method])) return false;

    return true;
    
}


function pyjslib_dir(obj) {

    var properties=new pyjslib_List();
    for (property in obj) properties.append(property);
    return properties;
    
}


function pyjslib_filter(obj, method, sequence) {
    if (typeof sequence == 'undefined') sequence=null;
    var items = new pyjslib_List([]);
    if ((sequence == null)) {
    var sequence = method;
    var method = obj;

        var __item = sequence.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    if (method(item)) {
    items.append(item);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else {

        var __item = sequence.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    if (method.call(obj, item)) {
    items.append(item);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    return items;
}


pyjslib_filter.parse_kwargs = function ( __kwargs, obj, method, sequence ) {
    if (typeof sequence == 'undefined')
        sequence=__kwargs.sequence;
    var __r = [obj, method, sequence];
    return __r;
};
function pyjslib_map(obj, method, sequence) {
    if (typeof sequence == 'undefined') sequence=null;
    var items = new pyjslib_List([]);
    if ((sequence == null)) {
    var sequence = method;
    var method = obj;

        var __item = sequence.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    items.append(method(item));

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else {

        var __item = sequence.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    items.append(method.call(obj, item));

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    return items;
}


pyjslib_map.parse_kwargs = function ( __kwargs, obj, method, sequence ) {
    if (typeof sequence == 'undefined')
        sequence=__kwargs.sequence;
    var __r = [obj, method, sequence];
    return __r;
};
function pyjslib_enumerate(sequence) {
    var enumeration = new pyjslib_List([]);
    var nextIndex = 0;

        var __item = sequence.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    enumeration.append(new pyjslib_List([nextIndex, item]));
    var nextIndex =  ( nextIndex + 1 ) ;

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return enumeration;
}


function pyjslib_min(sequence) {
    var minValue = null;

        var __item = sequence.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    if ((minValue == null)) {
    var minValue = item;
    }
    else if ((item < minValue)) {
    var minValue = item;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return minValue;
}


function pyjslib_max(sequence) {
    var maxValue = null;

        var __item = sequence.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    if ((maxValue == null)) {
    var maxValue = item;
    }
    else if ((item > maxValue)) {
    var maxValue = item;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return maxValue;
}


    var pyjslib_next_hash_id = 0;
function pyjslib_hash(obj) {

    if (obj == null) return null;
    
    if (obj.$H) return obj.$H;
    if (obj.__hash__) return obj.__hash__();
    if (obj.constructor == String || obj.constructor == Number || obj.constructor == Date) return obj;
    
    obj.$H = ++pyjslib_next_hash_id;
    return obj.$H;
    
}


function pyjslib_isObject(a) {

    return (a && typeof a == 'object') || pyjslib_isFunction(a);
    
}


function pyjslib_isFunction(a) {

    return typeof a == 'function';
    
}


function pyjslib_isString(a) {

    return typeof a == 'string';
    
}


function pyjslib_isNull(a) {

    return typeof a == 'object' && !a;
    
}


function pyjslib_isArray(a) {

    return pyjslib_isObject(a) && a.constructor == Array;
    
}


function pyjslib_isUndefined(a) {

    return typeof a == 'undefined';
    
}


function pyjslib_isIteratable(a) {

    return pyjslib_isObject(a) && a.__iter__;
    
}


function pyjslib_isNumber(a) {

    return typeof a == 'number' && isFinite(a);
    
}


function pyjslib_toJSObjects(x) {
    var result = x;
    if ((pyjslib_isObject(x)) && (x.__class__)) {
    if ((x.__class__ == 'pyjslib_Dict')) {
    return pyjslib_toJSObjects(x.d);
    }
    else if ((x.__class__ == 'pyjslib_List')) {
    return pyjslib_toJSObjects(x.l);
    }
    }
    if (pyjslib_isObject(x)) {

        result = {};
        for(var k in x) {
           var v = x[k];
           var tv = pyjslib_toJSObjects(v)
           result[k] = tv;
        }
        
    }
    if (pyjslib_isArray(x)) {

        result = [];
        for(var k=0; k < x.length; k++) {
           var v = x[k];
           var tv = pyjslib_toJSObjects(v);
           result.push(tv);
        }
        
    }
    return result;
}


function pyjslib_printFunc(objs) {

    var s = "";
    for(var i=0; i < objs.length; i++) {
        if(s != "") s += " ";
        s += objs[i];
    }
    console.debug(s)
    
}


__pyjslib_Dict_initialize();
__pyjslib_Object_initialize();
__pyjslib_List_initialize();
__pyjslib_Class_initialize();
__pyjslib_Tuple_initialize();

    var DOM_sCaptureElem = null;
    var DOM_sEventPreviewStack = new pyjslib_List([]);
    var DOM_currentEvent = null;
function DOM_init() {

    // Set up capture event dispatchers.
    $wnd.__dispatchCapturedMouseEvent = function(evt) {
        if ($wnd.__dispatchCapturedEvent(evt)) {
            var cap = DOM_getCaptureElement();
            if (cap && cap.__listener) {
                DOM_dispatchEvent(evt, cap, cap.__listener);
                evt.stopPropagation();
            }
        }
    };

    $wnd.__dispatchCapturedEvent = function(evt) {
        if (!DOM_previewEvent(evt)) {
            evt.stopPropagation();
            evt.preventDefault();
            return false;
        }

        return true;
        };

    $wnd.addEventListener(
        'mouseout',
        function(evt){
            var cap = DOM_getCaptureElement();
            if (cap) {
                if (!evt.relatedTarget) {
                    // When the mouse leaves the window during capture, release capture
                    // and synthesize an 'onlosecapture' event.
                    DOM_sCaptureElem = null;
                    if (cap.__listener) {
                        var lcEvent = $doc.createEvent('UIEvent');
                        lcEvent.initUIEvent('losecapture', false, false, $wnd, 0);
                        DOM_dispatchEvent(lcEvent, cap, cap.__listener);
                    }
                }
            }
        },
        true
    );


    $wnd.addEventListener('click', $wnd.__dispatchCapturedMouseEvent, true);
    $wnd.addEventListener('dblclick', $wnd.__dispatchCapturedMouseEvent, true);
    $wnd.addEventListener('mousedown', $wnd.__dispatchCapturedMouseEvent, true);
    $wnd.addEventListener('mouseup', $wnd.__dispatchCapturedMouseEvent, true);
    $wnd.addEventListener('mousemove', $wnd.__dispatchCapturedMouseEvent, true);
    $wnd.addEventListener('keydown', $wnd.__dispatchCapturedEvent, true);
    $wnd.addEventListener('keyup', $wnd.__dispatchCapturedEvent, true);
    $wnd.addEventListener('keypress', $wnd.__dispatchCapturedEvent, true);
    
    $wnd.__dispatchEvent = function(evt) {
    
        var listener, curElem = this;
        
        while (curElem && !(listener = curElem.__listener)) {
            curElem = curElem.parentNode;
        }
        if (curElem && curElem.nodeType != 1) {
            curElem = null;
        }
    
        if (listener) {
            DOM_dispatchEvent(evt, curElem, listener);
        }
    };
    
}


    DOM_init();
function DOM_addEventPreview(preview) {
    DOM_sEventPreviewStack.append(preview);
}


function DOM_appendChild(parent, child) {

    parent.appendChild(child);
    
}


function DOM_compare(elem1, elem2) {

    if (!elem1 && !elem2) {
        return true;
    } else if (!elem1 || !elem2) {
        return false;
    }
	if (!elem1.isSameNode) {
	    return (elem1 == elem2);
	}
    return (elem1.isSameNode(elem2));
    
}


function DOM_createAnchor() {
    return DOM_createElement('A');
}


function DOM_createButton() {
    return DOM_createElement('button');
}


function DOM_createCol() {
    return DOM_createElement('col');
}


function DOM_createDiv() {
    return DOM_createElement('div');
}


function DOM_createElement(tag) {

    return $doc.createElement(tag);
    
}


function DOM_createFieldSet() {
    return DOM_createElement('fieldset');
}


function DOM_createForm() {
    return DOM_createElement('form');
}


function DOM_createIFrame() {
    return DOM_createElement('iframe');
}


function DOM_createImg() {
    return DOM_createElement('img');
}


function DOM_createInputCheck() {
    return DOM_createInputElement('checkbox');
}


function DOM_createInputElement(elementType) {

    var e = $doc.createElement("INPUT");
    e.type = elementType;
    return e;
    
}


function DOM_createInputPassword() {
    return DOM_createInputElement('password');
}


function DOM_createInputRadio(group) {

    var elem = $doc.createElement("INPUT");
    elem.type = 'radio';
    elem.name = group;
    return elem;
    
}


function DOM_createInputText() {
    return DOM_createInputElement('text');
}


function DOM_createLabel() {
    return DOM_createElement('label');
}


function DOM_createLegend() {
    return DOM_createElement('legend');
}


function DOM_createOptions() {
    return DOM_createElement('options');
}


function DOM_createSelect() {
    return DOM_createElement('select');
}


function DOM_createSpan() {
    return DOM_createElement('span');
}


function DOM_createTable() {
    return DOM_createElement('table');
}


function DOM_createTBody() {
    return DOM_createElement('tbody');
}


function DOM_createTD() {
    return DOM_createElement('td');
}


function DOM_createTextArea() {
    return DOM_createElement('textarea');
}


function DOM_createTH() {
    return DOM_createElement('th');
}


function DOM_createTR() {
    return DOM_createElement('tr');
}


function DOM_eventCancelBubble(evt, cancel) {
    evt.cancelBubble = cancel;
}


function DOM_eventGetAltKey(evt) {

    return evt.altKey;
    
}


function DOM_eventGetButton(evt) {

    var button = evt.button;
    if(button == 0) {
        return 1;
    } else if (button == 1) {
        return 4;
    } else {
        return button;
    }
    
}


function DOM_eventGetClientX(evt) {

    return evt.clientX;
    
}


function DOM_eventGetClientY(evt) {

    return evt.clientY;
    
}


function DOM_eventGetCtrlKey(evt) {

    return evt.ctrlKey;
    
}


function DOM_eventGetFromElement(evt) {

    return evt.fromElement ? evt.fromElement : null;
    
}


function DOM_eventGetKeyCode(evt) {

    return evt.which ? evt.which : evt.keyCode;
    
}


function DOM_eventGetRepeat(evt) {

    return evt.repeat;
    
}


function DOM_eventGetScreenX(evt) {

    return evt.screenX;
    
}


function DOM_eventGetScreenY(evt) {

    return evt.screenY;
    
}


function DOM_eventGetShiftKey(evt) {

    return evt.shiftKey;
    
}


function DOM_eventGetTarget(event) {

    return event.target ? event.target : null;
    
}


function DOM_eventGetToElement(evt) {

    return evt.relatedTarget ? evt.relatedTarget : null;
    
}


function DOM_eventGetType(event) {

    return event.type;
    
}


function DOM_eventGetTypeInt(event) {

    switch (event.type) {
      case "blur": return 0x01000;
      case "change": return 0x00400;
      case "click": return 0x00001;
      case "dblclick": return 0x00002;
      case "focus": return 0x00800;
      case "keydown": return 0x00080;
      case "keypress": return 0x00100;
      case "keyup": return 0x00200;
      case "load": return 0x08000;
      case "losecapture": return 0x02000;
      case "mousedown": return 0x00004;
      case "mousemove": return 0x00040;
      case "mouseout": return 0x00020;
      case "mouseover": return 0x00010;
      case "mouseup": return 0x00008;
      case "scroll": return 0x04000;
      case "error": return 0x10000;
    }
    
}


function DOM_eventGetTypeString(event) {
    return DOM_eventGetType(event);
}


function DOM_eventPreventDefault(evt) {
    evt.preventDefault();
}


function DOM_eventSetKeyCode(evt, key) {

    evt.keyCode = key;
    
}


function DOM_eventToString(evt) {

    return evt.toString();
    
}


function DOM_iframeGetSrc(elem) {

    return elem.src;
    
}


function DOM_getAbsoluteLeft(elem) {

    var left = 0;
    var parent = elem;

    while (parent) {
        if (parent.scrollLeft > 0) {
            left = left -  parent.scrollLeft;
        }
        parent = parent.parentNode;
    }
    while (elem) {
        left = left + elem.offsetLeft;
        elem = elem.offsetParent;
    }

    return left + $doc.body.scrollLeft + $doc.documentElement.scrollLeft;
    
}


function DOM_getAbsoluteTop(elem) {

    var top = 0;
    var parent = elem;
    while (parent) {
        if (parent.scrollTop > 0) {
            top -= parent.scrollTop;
        }
        parent = parent.parentNode;
    }

    while (elem) {
        top += elem.offsetTop;
        elem = elem.offsetParent;
    }
    return top + $doc.body.scrollTop + $doc.documentElement.scrollTop;
    
}


function DOM_getAttribute(elem, attr) {

    var ret = elem[attr];
    return (ret == null) ? null : String(ret);
    
}


function DOM_getBooleanAttribute(elem, attr) {

    return !!elem[attr];
    
}


function DOM_getCaptureElement() {
    return DOM_sCaptureElem;
}


function DOM_getChild(elem, index) {

    var count = 0, child = elem.firstChild;
    while (child) {
      var next = child.nextSibling;
      if (child.nodeType == 1) {
        if (index == count)
          return child;
        ++count;
      }
      child = next;
    }

    return null;
    
}


function DOM_getChildCount(elem) {

    var count = 0, child = elem.firstChild;
    while (child) {
      if (child.nodeType == 1)
      ++count;
      child = child.nextSibling;
    }
    return count;
    
}


function DOM_getChildIndex(parent, child) {

    var count = 0, current = parent.firstChild;
    while (current) {
		if (! current.isSameNode) {
			if (current == child) {
			   return count;
		   }
		}
        else if (current.isSameNode(child)) {
            return count;
        }
        if (current.nodeType == 1) {
            ++count;
        }
        current = current.nextSibling;
    }
    return -1;
    
}


function DOM_getElementById(id) {

    var elem = $doc.getElementById(id);
    return elem ? elem : null;
    
}


function DOM_getEventListener(element) {

    return element.__listener;
    
}


function DOM_getEventsSunk(element) {

    return element.__eventBits ? element.__eventBits : 0;
    
}


function DOM_getFirstChild(elem) {

    var child = elem.firstChild;
    while (child && child.nodeType != 1)
      child = child.nextSibling;
    return child ? child : null;
    
}


function DOM_getInnerHTML(element) {

    var ret = element.innerHTML;
    return (ret == null) ? null : ret;
    
}


function DOM_getInnerText(element) {

    // To mimic IE's 'innerText' property in the W3C DOM, we need to recursively
    // concatenate all child text nodes (depth first).
    var text = '', child = element.firstChild;
    while (child) {
      if (child.nodeType == 1){ // 1 == Element node
        text += DOM_getInnerText(child);
      } else if (child.nodeValue) {
        text += child.nodeValue;
      }
      child = child.nextSibling;
    }
    return text;
    
}


function DOM_getIntAttribute(elem, attr) {

    var i = parseInt(elem[attr]);
    if (!i) {
        return 0;
    }
    return i;
    
}


function DOM_getIntStyleAttribute(elem, attr) {

    var i = parseInt(elem.style[attr]);
    if (!i) {
        return 0;
    }
    return i;
    
}


function DOM_getNextSibling(elem) {

    var sib = elem.nextSibling;
    while (sib && sib.nodeType != 1)
      sib = sib.nextSibling;
    return sib ? sib : null;
    
}


function DOM_getParent(elem) {

    var parent = elem.parentNode;
    if(parent == null) {
        return null;
    }
    if (parent.nodeType != 1)
        parent = null;
    return parent ? parent : null;
    
}


function DOM_getStyleAttribute(elem, attr) {

    var ret = elem.style[attr];
    return (ret == null) ? null : ret;
    
}


function DOM_insertChild(parent, toAdd, index) {

    var count = 0, child = parent.firstChild, before = null;
    while (child) {
      if (child.nodeType == 1) {
        if (count == index) {
          before = child;
          break;
        }
        ++count;
      }
      child = child.nextSibling;
    }

    parent.insertBefore(toAdd, before);
    
}


function DOM_iterChildren(elem) {

    var parent = elem;
    var child = elem.firstChild;
    var lastChild = null;
    return {
        'next': function() {
            if (child == null) {
                throw StopIteration;
            }
            lastChild = child;
            child = DOM_getNextSibling(child);
            return lastChild;
        },
        'remove': function() {        
            parent.removeChild(lastChild);
        },
        __iter__: function() {
            return this;
        }
    };
    
}


function DOM_walkChildren(elem) {

    var parent = elem;
    var child = DOM_getFirstChild(elem);
    var lastChild = null;
    var stack = [];
    var parentStack = [];
    return {
        'next': function() {
            if (child == null) {
                throw StopIteration;
            }
            lastChild = child;
            var firstChild = DOM_getFirstChild(child);
            var nextSibling = DOM_getNextSibling(child);
            if(firstChild != null) {
               if(nextSibling != null) {
                   stack.push(nextSibling);
                   parentStack.push(parent);
                }
                parent = child;
                child = firstChild;
            } else if(nextSibling != null) {
                child = nextSibling;
            } else if(stack.length > 0) {
                child = stack.pop();
                parent = parentStack.pop();
            } else {
                child = null;
            }
            return lastChild;
        },
        'remove': function() {        
            parent.removeChild(lastChild);
        },
        __iter__: function() {
            return this;
        }
    };
    
}


function DOM_isOrHasChild(parent, child) {

    while (child) {
		if ((!parent.isSameNode)) {
			if (parent == child) {
			   return true;
			}
		}
		else if (parent.isSameNode(child)) {
            return true;
        }
        child = child.parentNode;
        if (child && child.nodeType != 1) {
            child = null;
        }
    }
    return false;
    
}


function DOM_releaseCapture(elem) {

    if ((DOM_sCaptureElem != null) && DOM_compare(elem, DOM_sCaptureElem))
        DOM_sCaptureElem = null;
    
	if (!elem.isSameNode) {
		if (elem == $wnd.__captureElem) {
			$wnd.__captureElem = null;
		}
	}
	else if (elem.isSameNode($wnd.__captureElem)) {
        $wnd.__captureElem = null;
    }
    
}


function DOM_removeChild(parent, child) {

    parent.removeChild(child);
    
}


function DOM_replaceChild(parent, newChild, oldChild) {

    parent.replaceChild(newChild, oldChild);
    
}


function DOM_removeEventPreview(preview) {
    DOM_sEventPreviewStack.remove(preview);
}


function DOM_scrollIntoView(elem) {

    var left = elem.offsetLeft, top = elem.offsetTop;
    var width = elem.offsetWidth, height = elem.offsetHeight;
    
    if (elem.parentNode != elem.offsetParent) {
        left -= elem.parentNode.offsetLeft;
        top -= elem.parentNode.offsetTop;
    }

    var cur = elem.parentNode;
    while (cur && (cur.nodeType == 1)) {
        if ((cur.style.overflow == 'auto') || (cur.style.overflow == 'scroll')) {
            if (left < cur.scrollLeft) {
                cur.scrollLeft = left;
            }
            if (left + width > cur.scrollLeft + cur.clientWidth) {
                cur.scrollLeft = (left + width) - cur.clientWidth;
            }
            if (top < cur.scrollTop) {
                cur.scrollTop = top;
            }
            if (top + height > cur.scrollTop + cur.clientHeight) {
                cur.scrollTop = (top + height) - cur.clientHeight;
            }
        }

        var offsetLeft = cur.offsetLeft, offsetTop = cur.offsetTop;
        if (cur.parentNode != cur.offsetParent) {
            offsetLeft -= cur.parentNode.offsetLeft;
            offsetTop -= cur.parentNode.offsetTop;
        }

        left += offsetLeft - cur.scrollLeft;
        top += offsetTop - cur.scrollTop;
        cur = cur.parentNode;
    }
    
}


function DOM_removeAttribute(element, attribute) {

    delete element[attribute];
    
}


function DOM_setAttribute(element, attribute, value) {

    element[attribute] = value;
    
}


function DOM_setBooleanAttribute(elem, attr, value) {

    elem[attr] = value;
    
}


function DOM_setCapture(elem) {

    DOM_sCaptureElem = elem;
    
}


function DOM_setEventListener(element, listener) {

    element.__listener = listener;
    
}


function DOM_setInnerHTML(element, html) {

    if (!html) {
        html = "";
    }
    element.innerHTML = html;
    
}


function DOM_setInnerText(elem, text) {

    // Remove all children first.
    while (elem.firstChild) {
        elem.removeChild(elem.firstChild);
    }
    // Add a new text node.
    elem.appendChild($doc.createTextNode(text));
    
}


function DOM_setIntAttribute(elem, attr, value) {

    elem[attr] = value;
    
}


function DOM_setIntStyleAttribute(elem, attr, value) {

    elem.style[attr] = value;
    
}


function DOM_setOptionText(select, text, index) {

    var option = select.options[index];
    option.text = text;
    
}


function DOM_setStyleAttribute(element, name, value) {

    element.style[name] = value;
    
}


function DOM_sinkEvents(element, bits) {

    element.__eventBits = bits;
    
    element.onclick    = (bits & 0x00001) ? $wnd.__dispatchEvent : null;
    element.ondblclick  = (bits & 0x00002) ? $wnd.__dispatchEvent : null;
    element.onmousedown   = (bits & 0x00004) ? $wnd.__dispatchEvent : null;
    element.onmouseup    = (bits & 0x00008) ? $wnd.__dispatchEvent : null;
    element.onmouseover   = (bits & 0x00010) ? $wnd.__dispatchEvent : null;
    element.onmouseout  = (bits & 0x00020) ? $wnd.__dispatchEvent : null;
    element.onmousemove   = (bits & 0x00040) ? $wnd.__dispatchEvent : null;
    element.onkeydown    = (bits & 0x00080) ? $wnd.__dispatchEvent : null;
    element.onkeypress  = (bits & 0x00100) ? $wnd.__dispatchEvent : null;
    element.onkeyup    = (bits & 0x00200) ? $wnd.__dispatchEvent : null;
    element.onchange      = (bits & 0x00400) ? $wnd.__dispatchEvent : null;
    element.onfocus    = (bits & 0x00800) ? $wnd.__dispatchEvent : null;
    element.onblur      = (bits & 0x01000) ? $wnd.__dispatchEvent : null;
    element.onlosecapture = (bits & 0x02000) ? $wnd.__dispatchEvent : null;
    element.onscroll      = (bits & 0x04000) ? $wnd.__dispatchEvent : null;
    element.onload      = (bits & 0x08000) ? $wnd.__dispatchEvent : null;
    element.onerror    = (bits & 0x10000) ? $wnd.__dispatchEvent : null;
    
}


function DOM_toString(elem) {

    var temp = elem.cloneNode(true);
    var tempDiv = $doc.createElement("DIV");
    tempDiv.appendChild(temp);
    outer = tempDiv.innerHTML;
    temp.innerHTML = "";
    return outer;
    
}


function DOM_dispatchEvent(event, element, listener) {
    DOM_dispatchEventImpl(event, element, listener);
}


function DOM_previewEvent(evt) {
    var ret = true;
    if ((pyjslib_len(DOM_sEventPreviewStack) > 0)) {
    var preview = DOM_sEventPreviewStack.__getitem__( ( pyjslib_len(DOM_sEventPreviewStack) - 1 ) );
    var ret = preview.onEventPreview(evt);
    if (!(ret)) {
    DOM_eventCancelBubble(evt, true);
    DOM_eventPreventDefault(evt);
    }
    }
    return ret;
}


function DOM_dispatchEventAndCatch(evt, elem, listener, handler) {
}


function DOM_dispatchEventImpl(event, element, listener) {
    if ((element == DOM_sCaptureElem)) {
    if ((DOM_eventGetType(event) == 'losecapture')) {
    DOM_sCaptureElem = null;
    }
    }
    var prevCurrentEvent = DOM_currentEvent;
    DOM_currentEvent = event;
    listener.onBrowserEvent(event);
    DOM_currentEvent = prevCurrentEvent;
}


function DOM_eventGetCurrentEvent() {
    return DOM_currentEvent;
}


function DOM_insertListItem(select, item, value, index) {
    var option = DOM_createElement('OPTION');
    DOM_setInnerText(option, item);
    if ((value != null)) {
    DOM_setAttribute(option, 'value', value);
    }
    if ((index == -1)) {
    DOM_appendChild(select, option);
    }
    else {
    DOM_insertChild(select, option, index);
    }
}


function __sets_Set() {
}
function sets_Set(data) {
    if (typeof data == 'undefined') data=null;
    var instance = new __sets_Set();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


sets_Set.parse_kwargs = function ( __kwargs, data ) {
    if (typeof data == 'undefined')
        data=__kwargs.data;
    var __r = [data];
    return __r;
};
function __sets_Set_initialize() {
    if(__sets_Set.__was_initialized__) return;
    __sets_Set.__was_initialized__ = true;
    pyjs_extend(__sets_Set, __pyjslib_Object);
    __sets_Set.prototype.__class__.__new__ = sets_Set;
    __sets_Set.prototype.__init__ = function(data) {
    if (typeof data == 'undefined') data=null;

        this.d = {};
        this.update(data);
        
    };
__sets_Set.prototype.__init__.parse_kwargs = function ( __kwargs, data ) {
    if (typeof data == 'undefined')
        data=__kwargs.data;
    var __r = [data];
    return __r;
};
    __sets_Set.prototype.__class__.__init__ = function() {
        return __sets_Set.prototype.__init__.call.apply(__sets_Set.prototype.__init__, arguments);
    };
    __sets_Set.prototype.__class__.__init__.unbound_method = true;
    __sets_Set.prototype.__init__.instance_method = true;
    __sets_Set.prototype.__class__.__init__.parse_kwargs = __sets_Set.prototype.__init__.parse_kwargs;
    __sets_Set.prototype.add = function(value) {
    this.d[pyjslib_hash(value)] = value;
    };
    __sets_Set.prototype.__class__.add = function() {
        return __sets_Set.prototype.add.call.apply(__sets_Set.prototype.add, arguments);
    };
    __sets_Set.prototype.__class__.add.unbound_method = true;
    __sets_Set.prototype.add.instance_method = true;
    __sets_Set.prototype.clear = function() {
    this.d = {};
    };
    __sets_Set.prototype.__class__.clear = function() {
        return __sets_Set.prototype.clear.call.apply(__sets_Set.prototype.clear, arguments);
    };
    __sets_Set.prototype.__class__.clear.unbound_method = true;
    __sets_Set.prototype.clear.instance_method = true;
    __sets_Set.prototype.__contains__ = function(value) {
    return (this.d[pyjslib_hash(value)]) ? true : false;
    };
    __sets_Set.prototype.__class__.__contains__ = function() {
        return __sets_Set.prototype.__contains__.call.apply(__sets_Set.prototype.__contains__, arguments);
    };
    __sets_Set.prototype.__class__.__contains__.unbound_method = true;
    __sets_Set.prototype.__contains__.instance_method = true;
    __sets_Set.prototype.discard = function(value) {
    delete this.d[pyjslib_hash(value)];
    };
    __sets_Set.prototype.__class__.discard = function() {
        return __sets_Set.prototype.discard.call.apply(__sets_Set.prototype.discard, arguments);
    };
    __sets_Set.prototype.__class__.discard.unbound_method = true;
    __sets_Set.prototype.discard.instance_method = true;
    __sets_Set.prototype.issubset = function(items) {

        for (var i in this.d) {
            if (!items.__contains__(i)) return false;
            }
        return true;
        
    };
    __sets_Set.prototype.__class__.issubset = function() {
        return __sets_Set.prototype.issubset.call.apply(__sets_Set.prototype.issubset, arguments);
    };
    __sets_Set.prototype.__class__.issubset.unbound_method = true;
    __sets_Set.prototype.issubset.instance_method = true;
    __sets_Set.prototype.issuperset = function(items) {

        for (var i in items) {
            if (!this.__contains__(i)) return false;
            }
        return true;
        
    };
    __sets_Set.prototype.__class__.issuperset = function() {
        return __sets_Set.prototype.issuperset.call.apply(__sets_Set.prototype.issuperset, arguments);
    };
    __sets_Set.prototype.__class__.issuperset.unbound_method = true;
    __sets_Set.prototype.issuperset.instance_method = true;
    __sets_Set.prototype.__iter__ = function() {

        var items=new pyjslib_List();
        for (var key in this.d) items.append(this.d[key]);
        return items.__iter__();
        
    };
    __sets_Set.prototype.__class__.__iter__ = function() {
        return __sets_Set.prototype.__iter__.call.apply(__sets_Set.prototype.__iter__, arguments);
    };
    __sets_Set.prototype.__class__.__iter__.unbound_method = true;
    __sets_Set.prototype.__iter__.instance_method = true;
    __sets_Set.prototype.__len__ = function() {

        var size=0;
        for (var i in this.d) size++;
        return size;
        
    };
    __sets_Set.prototype.__class__.__len__ = function() {
        return __sets_Set.prototype.__len__.call.apply(__sets_Set.prototype.__len__, arguments);
    };
    __sets_Set.prototype.__class__.__len__.unbound_method = true;
    __sets_Set.prototype.__len__.instance_method = true;
    __sets_Set.prototype.pop = function() {

        for (var key in this.d) {
            var value = this.d[key];
            delete this.d[key];
            return value;
            }
        
    };
    __sets_Set.prototype.__class__.pop = function() {
        return __sets_Set.prototype.pop.call.apply(__sets_Set.prototype.pop, arguments);
    };
    __sets_Set.prototype.__class__.pop.unbound_method = true;
    __sets_Set.prototype.pop.instance_method = true;
    __sets_Set.prototype.remove = function(value) {
    this.discard(value);
    };
    __sets_Set.prototype.__class__.remove = function() {
        return __sets_Set.prototype.remove.call.apply(__sets_Set.prototype.remove, arguments);
    };
    __sets_Set.prototype.__class__.remove.unbound_method = true;
    __sets_Set.prototype.remove.instance_method = true;
    __sets_Set.prototype.update = function(data) {

        if (pyjslib_isArray(data)) {
            for (var i in data) {
                this.d[pyjslib_hash(data[i])]=data[i];
            }
        }
        else if (pyjslib_isIteratable(data)) {
            var iter=data.__iter__();
            var i=0;
            try {
                while (true) {
                    var item=iter.next();
                    this.d[pyjslib_hash(item)]=item;
                }
            }
            catch (e) {
                if (e != StopIteration) throw e;
            }
        }
        
    };
    __sets_Set.prototype.__class__.update = function() {
        return __sets_Set.prototype.update.call.apply(__sets_Set.prototype.update, arguments);
    };
    __sets_Set.prototype.__class__.update.unbound_method = true;
    __sets_Set.prototype.update.instance_method = true;
}
__sets_Set_initialize();
function Location_makeUrlDict(s) {
    var dict = new pyjslib_Dict([]);
    var pairs = s.split('&');

        var __pair = pairs.__iter__();
        try {
            while (true) {
                var pair = __pair.next();
                
        
    if ((pyjslib_len(pair) < 3)) {
    continue;
    }
    var kv = pair.split('=', 1);
    dict.__setitem__(kv.__getitem__(0), kv.__getitem__(1));

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return dict;
}


function Location_makeUrlStringFromDict(d) {
    var pairs = new pyjslib_List([]);

        var __temp_k = d.iteritems().__iter__();
        try {
            while (true) {
                var temp_k = __temp_k.next();
                
                var k = temp_k.__getitem__(0);
                
                var v = temp_k.__getitem__(1);
                
        
    pairs.append( (  ( k + '=' )  + v ) );

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return '&'.join(pairs);
}


function __Location_Location() {
}
function Location_Location(location) {
    var instance = new __Location_Location();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __Location_Location_initialize() {
    if(__Location_Location.__was_initialized__) return;
    __Location_Location.__was_initialized__ = true;
    pyjs_extend(__Location_Location, __pyjslib_Object);
    __Location_Location.prototype.__class__.__new__ = Location_Location;
    __Location_Location.prototype.__init__ = function(location) {
    this.location = location;
    };
    __Location_Location.prototype.__class__.__init__ = function() {
        return __Location_Location.prototype.__init__.call.apply(__Location_Location.prototype.__init__, arguments);
    };
    __Location_Location.prototype.__class__.__init__.unbound_method = true;
    __Location_Location.prototype.__init__.instance_method = true;
    __Location_Location.prototype.getHash = function() {
    return this.location.hash;
    };
    __Location_Location.prototype.__class__.getHash = function() {
        return __Location_Location.prototype.getHash.call.apply(__Location_Location.prototype.getHash, arguments);
    };
    __Location_Location.prototype.__class__.getHash.unbound_method = true;
    __Location_Location.prototype.getHash.instance_method = true;
    __Location_Location.prototype.getHashDict = function() {
    if ((!(this.hashDict)) || ((this.hashDictHash != this.getHash()))) {
    this.hashDictHash = this.getHash();
    this.hashDict = Location_makeUrlDict(this.getHash().slice(1));
    }
    return this.hashDict;
    };
    __Location_Location.prototype.__class__.getHashDict = function() {
        return __Location_Location.prototype.getHashDict.call.apply(__Location_Location.prototype.getHashDict, arguments);
    };
    __Location_Location.prototype.__class__.getHashDict.unbound_method = true;
    __Location_Location.prototype.getHashDict.instance_method = true;
    __Location_Location.prototype.getHost = function() {
    return this.location.host;
    };
    __Location_Location.prototype.__class__.getHost = function() {
        return __Location_Location.prototype.getHost.call.apply(__Location_Location.prototype.getHost, arguments);
    };
    __Location_Location.prototype.__class__.getHost.unbound_method = true;
    __Location_Location.prototype.getHost.instance_method = true;
    __Location_Location.prototype.getHostname = function() {
    return this.location.hostname;
    };
    __Location_Location.prototype.__class__.getHostname = function() {
        return __Location_Location.prototype.getHostname.call.apply(__Location_Location.prototype.getHostname, arguments);
    };
    __Location_Location.prototype.__class__.getHostname.unbound_method = true;
    __Location_Location.prototype.getHostname.instance_method = true;
    __Location_Location.prototype.getHref = function() {
    return this.location.href;
    };
    __Location_Location.prototype.__class__.getHref = function() {
        return __Location_Location.prototype.getHref.call.apply(__Location_Location.prototype.getHref, arguments);
    };
    __Location_Location.prototype.__class__.getHref.unbound_method = true;
    __Location_Location.prototype.getHref.instance_method = true;
    __Location_Location.prototype.getPageHref = function() {
    var href = this.location.href;
    if (href.find('?')) {
    var href = href.split('?').__getitem__(0);
    }
    if (href.find('#')) {
    var href = href.split('#').__getitem__(0);
    }
    return href;
    };
    __Location_Location.prototype.__class__.getPageHref = function() {
        return __Location_Location.prototype.getPageHref.call.apply(__Location_Location.prototype.getPageHref, arguments);
    };
    __Location_Location.prototype.__class__.getPageHref.unbound_method = true;
    __Location_Location.prototype.getPageHref.instance_method = true;
    __Location_Location.prototype.getPathname = function() {
    return this.location.pathname;
    };
    __Location_Location.prototype.__class__.getPathname = function() {
        return __Location_Location.prototype.getPathname.call.apply(__Location_Location.prototype.getPathname, arguments);
    };
    __Location_Location.prototype.__class__.getPathname.unbound_method = true;
    __Location_Location.prototype.getPathname.instance_method = true;
    __Location_Location.prototype.getPort = function() {
    return this.location.port;
    };
    __Location_Location.prototype.__class__.getPort = function() {
        return __Location_Location.prototype.getPort.call.apply(__Location_Location.prototype.getPort, arguments);
    };
    __Location_Location.prototype.__class__.getPort.unbound_method = true;
    __Location_Location.prototype.getPort.instance_method = true;
    __Location_Location.prototype.getProtocol = function() {
    return this.location.protocol;
    };
    __Location_Location.prototype.__class__.getProtocol = function() {
        return __Location_Location.prototype.getProtocol.call.apply(__Location_Location.prototype.getProtocol, arguments);
    };
    __Location_Location.prototype.__class__.getProtocol.unbound_method = true;
    __Location_Location.prototype.getProtocol.instance_method = true;
    __Location_Location.prototype.getSearch = function() {
    return  ( '' + this.location.search ) ;
    };
    __Location_Location.prototype.__class__.getSearch = function() {
        return __Location_Location.prototype.getSearch.call.apply(__Location_Location.prototype.getSearch, arguments);
    };
    __Location_Location.prototype.__class__.getSearch.unbound_method = true;
    __Location_Location.prototype.getSearch.instance_method = true;
    __Location_Location.prototype.getSearchDict = function() {
    if (!(this.searchDict)) {
    this.searchDict = Location_makeUrlDict(this.getSearch().slice(1));
    }
    return this.searchDict;
    };
    __Location_Location.prototype.__class__.getSearchDict = function() {
        return __Location_Location.prototype.getSearchDict.call.apply(__Location_Location.prototype.getSearchDict, arguments);
    };
    __Location_Location.prototype.__class__.getSearchDict.unbound_method = true;
    __Location_Location.prototype.getSearchDict.instance_method = true;
    __Location_Location.prototype.getSearchVar = function(key) {
    var searchDict = this.getSearchDict();
    return searchDict.__getitem__(key);
    };
    __Location_Location.prototype.__class__.getSearchVar = function() {
        return __Location_Location.prototype.getSearchVar.call.apply(__Location_Location.prototype.getSearchVar, arguments);
    };
    __Location_Location.prototype.__class__.getSearchVar.unbound_method = true;
    __Location_Location.prototype.getSearchVar.instance_method = true;
    __Location_Location.prototype.reload = function() {
    this.location.reload();
    };
    __Location_Location.prototype.__class__.reload = function() {
        return __Location_Location.prototype.reload.call.apply(__Location_Location.prototype.reload, arguments);
    };
    __Location_Location.prototype.__class__.reload.unbound_method = true;
    __Location_Location.prototype.reload.instance_method = true;
    __Location_Location.prototype.setHref = function(href) {
    this.location.href = href;
    };
    __Location_Location.prototype.__class__.setHref = function() {
        return __Location_Location.prototype.setHref.call.apply(__Location_Location.prototype.setHref, arguments);
    };
    __Location_Location.prototype.__class__.setHref.unbound_method = true;
    __Location_Location.prototype.setHref.instance_method = true;
    __Location_Location.prototype.setSearch = function(search) {
    this.location.search = search;
    };
    __Location_Location.prototype.__class__.setSearch = function() {
        return __Location_Location.prototype.setSearch.call.apply(__Location_Location.prototype.setSearch, arguments);
    };
    __Location_Location.prototype.__class__.setSearch.unbound_method = true;
    __Location_Location.prototype.setSearch.instance_method = true;
    __Location_Location.prototype.setSearchDict = function(searchDict) {
    this.setSearch(Location_makeUrlStringFromDict(searchDict));
    };
    __Location_Location.prototype.__class__.setSearchDict = function() {
        return __Location_Location.prototype.setSearchDict.call.apply(__Location_Location.prototype.setSearchDict, arguments);
    };
    __Location_Location.prototype.__class__.setSearchDict.unbound_method = true;
    __Location_Location.prototype.setSearchDict.instance_method = true;
    __Location_Location.prototype.setHash = function(hash) {
    this.location.hash = hash;
    };
    __Location_Location.prototype.__class__.setHash = function() {
        return __Location_Location.prototype.setHash.call.apply(__Location_Location.prototype.setHash, arguments);
    };
    __Location_Location.prototype.__class__.setHash.unbound_method = true;
    __Location_Location.prototype.setHash.instance_method = true;
    __Location_Location.prototype.setHashDict = function(hashDict) {
    this.setHash(Location_makeUrlStringFromDict(hashDict));
    };
    __Location_Location.prototype.__class__.setHashDict = function() {
        return __Location_Location.prototype.setHashDict.call.apply(__Location_Location.prototype.setHashDict, arguments);
    };
    __Location_Location.prototype.__class__.setHashDict.unbound_method = true;
    __Location_Location.prototype.setHashDict.instance_method = true;
}
__Location_Location_initialize();
    var Window_closingListeners = new pyjslib_List([]);
    var Window_resizeListeners = new pyjslib_List([]);
function Window_addWindowCloseListener(listener) {
    Window_closingListeners.append(listener);
}


function Window_addWindowResizeListener(listener) {
    Window_resizeListeners.append(listener);
}


function Window_alert(msg) {

    $wnd.alert(msg);
    
}


function Window_confirm(msg) {

    return $wnd.confirm(msg);
    
}


function Window_prompt(msg, defaultReply) {
    if (typeof defaultReply == 'undefined') defaultReply='';

        return $wnd.prompt(msg, defaultReply);
    
}


Window_prompt.parse_kwargs = function ( __kwargs, msg, defaultReply ) {
    if (typeof defaultReply == 'undefined')
        defaultReply=__kwargs.defaultReply;
    var __r = [msg, defaultReply];
    return __r;
};
function Window_enableScrolling(enable) {

   $doc.body.style.overflow = enable ? 'auto' : 'hidden';
   
}


function Window_getClientHeight() {

    if ($wnd.innerHeight)
        return $wnd.innerHeight;
    return $doc.body.clientHeight;
    
}


function Window_getClientWidth() {

    if ($wnd.innerWidth)
        return $wnd.innerWidth;
    return $doc.body.clientWidth;
    
}


var Window_location = null
function Window_getLocation() {

    if(!Window_location)
       Window_location = Location_Location($wnd.location);
    return Window_location;
    
}


function Window_getTitle() {

    return $doc.title;
    
}


function Window_open(url, name, features) {

    $wnd.open(url, name, features);
    
}


function Window_removeWindowCloseListener(listener) {
    Window_closingListeners.remove(listener);
}


function Window_removeWindowResizeListener(listener) {
    Window_resizeListeners.remove(listener);
}


function Window_setMargin(size) {

    $doc.body.style.margin = size;
    
}


function Window_setTitle(title) {

    $doc.title = title;
    
}


function Window_onClosed() {
    Window_fireClosedImpl();
}


function Window_onClosing() {
    Window_fireClosingImpl();
}


function Window_onResize() {
    Window_fireResizedImpl();
}


function Window_fireClosedAndCatch(handler) {
}


function Window_fireClosedImpl() {

        var __listener = Window_closingListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onWindowClosed();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
}


function Window_fireClosingAndCatch(handler) {
}


function Window_fireClosingImpl() {
    var ret = null;

        var __listener = Window_closingListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    var msg = listener.onWindowClosing();
    if ((ret == null)) {
    var ret = msg;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return ret;
}


function Window_fireResizedAndCatch(handler) {
}


function Window_fireResizedImpl() {

        var __listener = Window_resizeListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onWindowResized(Window_getClientWidth(), Window_getClientHeight());

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
}


function Window_init() {

    $wnd.__pygwt_initHandlers(
        function() {
            Window_onResize();
        },
        function() {
            return Window_onClosing();
        },
        function() {
            Window_onClosed();
            /*$wnd.onresize = null;
            $wnd.onbeforeclose = null;
            $wnd.onclose = null;*/
        }
    );
    
}


    Window_init();
    var Timer_timers = new pyjslib_List([]);
function __Timer_Timer() {
}
function Timer_Timer(delay, object) {
    if (typeof delay == 'undefined') delay=0;
    if (typeof object == 'undefined') object=null;
    var instance = new __Timer_Timer();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


Timer_Timer.parse_kwargs = function ( __kwargs, delay, object ) {
    if (typeof delay == 'undefined')
        delay=__kwargs.delay;
    if (typeof object == 'undefined')
        object=__kwargs.object;
    var __r = [delay, object];
    return __r;
};
function __Timer_Timer_initialize() {
    if(__Timer_Timer.__was_initialized__) return;
    __Timer_Timer.__was_initialized__ = true;
    pyjs_extend(__Timer_Timer, __pyjslib_Object);
    __Timer_Timer.prototype.__class__.__new__ = Timer_Timer;
    __Timer_Timer.prototype.__class__.MIN_PERIOD = 1;
    __Timer_Timer.prototype.__init__ = function(delay, object) {
    if (typeof delay == 'undefined') delay=0;
    if (typeof object == 'undefined') object=null;
    this.isRepeating = false;
    this.timerId = 0;
    this.listener = object;
    if ((delay >= __Timer_Timer.prototype.__class__.MIN_PERIOD)) {
    this.schedule(delay);
    }
    };
__Timer_Timer.prototype.__init__.parse_kwargs = function ( __kwargs, delay, object ) {
    if (typeof delay == 'undefined')
        delay=__kwargs.delay;
    if (typeof object == 'undefined')
        object=__kwargs.object;
    var __r = [delay, object];
    return __r;
};
    __Timer_Timer.prototype.__class__.__init__ = function() {
        return __Timer_Timer.prototype.__init__.call.apply(__Timer_Timer.prototype.__init__, arguments);
    };
    __Timer_Timer.prototype.__class__.__init__.unbound_method = true;
    __Timer_Timer.prototype.__init__.instance_method = true;
    __Timer_Timer.prototype.__class__.__init__.parse_kwargs = __Timer_Timer.prototype.__init__.parse_kwargs;
    __Timer_Timer.prototype.clearInterval = function(id) {

        $wnd.clearInterval(id);
        
    };
    __Timer_Timer.prototype.__class__.clearInterval = function() {
        return __Timer_Timer.prototype.clearInterval.call.apply(__Timer_Timer.prototype.clearInterval, arguments);
    };
    __Timer_Timer.prototype.__class__.clearInterval.unbound_method = true;
    __Timer_Timer.prototype.clearInterval.instance_method = true;
    __Timer_Timer.prototype.clearTimeout = function(id) {

        $wnd.clearTimeout(id);
        
    };
    __Timer_Timer.prototype.__class__.clearTimeout = function() {
        return __Timer_Timer.prototype.clearTimeout.call.apply(__Timer_Timer.prototype.clearTimeout, arguments);
    };
    __Timer_Timer.prototype.__class__.clearTimeout.unbound_method = true;
    __Timer_Timer.prototype.clearTimeout.instance_method = true;
    __Timer_Timer.prototype.createInterval = function(timer, period) {

        return $wnd.setInterval(function() { timer.fire(); }, period);
        
    };
    __Timer_Timer.prototype.__class__.createInterval = function() {
        return __Timer_Timer.prototype.createInterval.call.apply(__Timer_Timer.prototype.createInterval, arguments);
    };
    __Timer_Timer.prototype.__class__.createInterval.unbound_method = true;
    __Timer_Timer.prototype.createInterval.instance_method = true;
    __Timer_Timer.prototype.createTimeout = function(timer, delay) {

        return $wnd.setTimeout(function() { timer.fire(); }, delay);
        
    };
    __Timer_Timer.prototype.__class__.createTimeout = function() {
        return __Timer_Timer.prototype.createTimeout.call.apply(__Timer_Timer.prototype.createTimeout, arguments);
    };
    __Timer_Timer.prototype.__class__.createTimeout.unbound_method = true;
    __Timer_Timer.prototype.createTimeout.instance_method = true;
    __Timer_Timer.prototype.hookWindowClosing = function() {
    };
    __Timer_Timer.prototype.__class__.hookWindowClosing = function() {
        return __Timer_Timer.prototype.hookWindowClosing.call.apply(__Timer_Timer.prototype.hookWindowClosing, arguments);
    };
    __Timer_Timer.prototype.__class__.hookWindowClosing.unbound_method = true;
    __Timer_Timer.prototype.hookWindowClosing.instance_method = true;
    __Timer_Timer.prototype.cancel = function() {
    if (this.isRepeating) {
    this.clearInterval(this.timerId);
    }
    else {
    this.clearTimeout(this.timerId);
    }
    Timer_timers.remove(this);
    };
    __Timer_Timer.prototype.__class__.cancel = function() {
        return __Timer_Timer.prototype.cancel.call.apply(__Timer_Timer.prototype.cancel, arguments);
    };
    __Timer_Timer.prototype.__class__.cancel.unbound_method = true;
    __Timer_Timer.prototype.cancel.instance_method = true;
    __Timer_Timer.prototype.run = function() {
    if (this.listener) {
    this.listener.onTimer(this.timerId);
    }
    };
    __Timer_Timer.prototype.__class__.run = function() {
        return __Timer_Timer.prototype.run.call.apply(__Timer_Timer.prototype.run, arguments);
    };
    __Timer_Timer.prototype.__class__.run.unbound_method = true;
    __Timer_Timer.prototype.run.instance_method = true;
    __Timer_Timer.prototype.schedule = function(delayMillis) {
    if ((delayMillis < __Timer_Timer.prototype.__class__.MIN_PERIOD)) {
    alert('Timer delay must be positive');
    }
    this.cancel();
    this.isRepeating = false;
    this.timerId = this.createTimeout(this, delayMillis);
    Timer_timers.append(this);
    };
    __Timer_Timer.prototype.__class__.schedule = function() {
        return __Timer_Timer.prototype.schedule.call.apply(__Timer_Timer.prototype.schedule, arguments);
    };
    __Timer_Timer.prototype.__class__.schedule.unbound_method = true;
    __Timer_Timer.prototype.schedule.instance_method = true;
    __Timer_Timer.prototype.scheduleRepeating = function(periodMillis) {
    if ((periodMillis < __Timer_Timer.prototype.__class__.MIN_PERIOD)) {
    alert('Timer period must be positive');
    }
    this.cancel();
    this.isRepeating = true;
    this.timerId = this.createInterval(this, periodMillis);
    Timer_timers.append(this);
    };
    __Timer_Timer.prototype.__class__.scheduleRepeating = function() {
        return __Timer_Timer.prototype.scheduleRepeating.call.apply(__Timer_Timer.prototype.scheduleRepeating, arguments);
    };
    __Timer_Timer.prototype.__class__.scheduleRepeating.unbound_method = true;
    __Timer_Timer.prototype.scheduleRepeating.instance_method = true;
    __Timer_Timer.prototype.fire = function() {
    this.fireImpl();
    };
    __Timer_Timer.prototype.__class__.fire = function() {
        return __Timer_Timer.prototype.fire.call.apply(__Timer_Timer.prototype.fire, arguments);
    };
    __Timer_Timer.prototype.__class__.fire.unbound_method = true;
    __Timer_Timer.prototype.fire.instance_method = true;
    __Timer_Timer.prototype.fireImpl = function() {
    if (!(this.isRepeating)) {
    Timer_timers.remove(this);
    }
    this.run();
    };
    __Timer_Timer.prototype.__class__.fireImpl = function() {
        return __Timer_Timer.prototype.fireImpl.call.apply(__Timer_Timer.prototype.fireImpl, arguments);
    };
    __Timer_Timer.prototype.__class__.fireImpl.unbound_method = true;
    __Timer_Timer.prototype.fireImpl.instance_method = true;
    __Timer_Timer.prototype.getID = function() {
    return this.timerId;
    };
    __Timer_Timer.prototype.__class__.getID = function() {
        return __Timer_Timer.prototype.getID.call.apply(__Timer_Timer.prototype.getID, arguments);
    };
    __Timer_Timer.prototype.__class__.getID.unbound_method = true;
    __Timer_Timer.prototype.getID.instance_method = true;
}
__Timer_Timer_initialize();
    var DeferredCommand_deferredCommands = new pyjslib_List([]);
    var DeferredCommand_timerIsActive = false;
function __DeferredCommand_DeferredCommand() {
}
function DeferredCommand_DeferredCommand() {
    var instance = new __DeferredCommand_DeferredCommand();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __DeferredCommand_DeferredCommand_initialize() {
    if(__DeferredCommand_DeferredCommand.__was_initialized__) return;
    __DeferredCommand_DeferredCommand.__was_initialized__ = true;
    pyjs_extend(__DeferredCommand_DeferredCommand, __pyjslib_Object);
    __DeferredCommand_DeferredCommand.prototype.__class__.__new__ = DeferredCommand_DeferredCommand;
    __DeferredCommand_DeferredCommand.prototype.add = function(cmd) {
    DeferredCommand_deferredCommands.append(cmd);
    this.maybeSetDeferredCommandTimer();
    };
    __DeferredCommand_DeferredCommand.prototype.__class__.add = function() {
        return __DeferredCommand_DeferredCommand.prototype.add.call.apply(__DeferredCommand_DeferredCommand.prototype.add, arguments);
    };
    __DeferredCommand_DeferredCommand.prototype.__class__.add.unbound_method = true;
    __DeferredCommand_DeferredCommand.prototype.add.instance_method = true;
    __DeferredCommand_DeferredCommand.prototype.flushDeferredCommands = function() {

        var __i = pyjslib_range(pyjslib_len(DeferredCommand_deferredCommands)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var current = DeferredCommand_deferredCommands.__getitem__(0);
    DeferredCommand_deferredCommands.__delitem__(0);
    if ((current == null)) {
    return;
    }
    else {
    current.execute();
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __DeferredCommand_DeferredCommand.prototype.__class__.flushDeferredCommands = function() {
        return __DeferredCommand_DeferredCommand.prototype.flushDeferredCommands.call.apply(__DeferredCommand_DeferredCommand.prototype.flushDeferredCommands, arguments);
    };
    __DeferredCommand_DeferredCommand.prototype.__class__.flushDeferredCommands.unbound_method = true;
    __DeferredCommand_DeferredCommand.prototype.flushDeferredCommands.instance_method = true;
    __DeferredCommand_DeferredCommand.prototype.maybeSetDeferredCommandTimer = function() {
    if ((!(DeferredCommand_timerIsActive)) && (!((pyjslib_len(DeferredCommand_deferredCommands) == 0)))) {
    Timer_Timer(1, this);
    DeferredCommand_timerIsActive = true;
    }
    };
    __DeferredCommand_DeferredCommand.prototype.__class__.maybeSetDeferredCommandTimer = function() {
        return __DeferredCommand_DeferredCommand.prototype.maybeSetDeferredCommandTimer.call.apply(__DeferredCommand_DeferredCommand.prototype.maybeSetDeferredCommandTimer, arguments);
    };
    __DeferredCommand_DeferredCommand.prototype.__class__.maybeSetDeferredCommandTimer.unbound_method = true;
    __DeferredCommand_DeferredCommand.prototype.maybeSetDeferredCommandTimer.instance_method = true;
    __DeferredCommand_DeferredCommand.prototype.onTimer = function() {
    this.flushDeferredCommands();
    DeferredCommand_timerIsActive = false;
    this.maybeSetDeferredCommandTimer();
    };
    __DeferredCommand_DeferredCommand.prototype.__class__.onTimer = function() {
        return __DeferredCommand_DeferredCommand.prototype.onTimer.call.apply(__DeferredCommand_DeferredCommand.prototype.onTimer, arguments);
    };
    __DeferredCommand_DeferredCommand.prototype.__class__.onTimer.unbound_method = true;
    __DeferredCommand_DeferredCommand.prototype.onTimer.instance_method = true;
}
__DeferredCommand_DeferredCommand_initialize();
    var pygwt_sNextHashId = 0;
function pygwt_getNextHashId() {
    pygwt_sNextHashId += 1;
    return pygwt_sNextHashId;
}


function pygwt_getHashCode(o) {

    return (o == null) ? 0 :
        (o.$H ? o.$H : (o.$H = pygwt_getNextHashId()));
    
}


function pygwt_getModuleName() {

    return $moduleName;
    
}


function pygwt_getModuleBaseURL() {

    // this is intentionally not using $doc, because we want the module's own url
    var s = document.location.href;
    
    // Pull off any hash.
    var i = s.indexOf('#');
    if (i != -1)
        s = s.substring(0, i);
    
    // Pull off any query string.
    i = s.indexOf('?');
    if (i != -1)
        s = s.substring(0, i);
    
    // Rip off everything after the last slash.
    i = s.lastIndexOf('/');
    if (i != -1)
        s = s.substring(0, i);

    return (s.length > 0) ? s + "/" : "";
    
}


function History_init() {

    $wnd.__historyToken = '';

    // Get the initial token from the url's hash component.
    var hash = $wnd.location.hash;
    if (hash.length > 0)
        $wnd.__historyToken = decodeURIComponent(hash.substring(1));

    // Create the timer that checks the browser's url hash every 1/4 s.
    $wnd.__checkHistory = function() {
        var token = '', hash = $wnd.location.hash;
        if (hash.length > 0)
            token = decodeURIComponent(hash.substring(1));

        if (token != $wnd.__historyToken) {
            $wnd.__historyToken = token;
            // TODO - move init back into History
            // this.onHistoryChanged(token);
            var h = new __History_History();
            h.onHistoryChanged(token);
        }

        $wnd.setTimeout('__checkHistory()', 250);
    };

    // Kick off the timer.
    $wnd.__checkHistory();

    return true;
    
}


    var History_historyListeners = new pyjslib_List([]);
    History_init();
function __History_History() {
}
function History_History() {
    var instance = new __History_History();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __History_History_initialize() {
    if(__History_History.__was_initialized__) return;
    __History_History.__was_initialized__ = true;
    pyjs_extend(__History_History, __pyjslib_Object);
    __History_History.prototype.__class__.__new__ = History_History;
    __History_History.prototype.addHistoryListener = function(listener) {
    History_historyListeners.append(listener);
    };
    __History_History.prototype.__class__.addHistoryListener = function() {
        return __History_History.prototype.addHistoryListener.call.apply(__History_History.prototype.addHistoryListener, arguments);
    };
    __History_History.prototype.__class__.addHistoryListener.unbound_method = true;
    __History_History.prototype.addHistoryListener.instance_method = true;
    __History_History.prototype.back = function() {

        $wnd.history.back();
        
    };
    __History_History.prototype.__class__.back = function() {
        return __History_History.prototype.back.call.apply(__History_History.prototype.back, arguments);
    };
    __History_History.prototype.__class__.back.unbound_method = true;
    __History_History.prototype.back.instance_method = true;
    __History_History.prototype.forward = function() {

        $wnd.history.forward();
        
    };
    __History_History.prototype.__class__.forward = function() {
        return __History_History.prototype.forward.call.apply(__History_History.prototype.forward, arguments);
    };
    __History_History.prototype.__class__.forward.unbound_method = true;
    __History_History.prototype.forward.instance_method = true;
    __History_History.prototype.getToken = function() {

        return $wnd.__historyToken;
        
    };
    __History_History.prototype.__class__.getToken = function() {
        return __History_History.prototype.getToken.call.apply(__History_History.prototype.getToken, arguments);
    };
    __History_History.prototype.__class__.getToken.unbound_method = true;
    __History_History.prototype.getToken.instance_method = true;
    __History_History.prototype.newItem = function(historyToken) {

        if(historyToken == "" || historyToken == null){
            historyToken = "#";
        }
        $wnd.location.hash = encodeURIComponent(historyToken);
        
    };
    __History_History.prototype.__class__.newItem = function() {
        return __History_History.prototype.newItem.call.apply(__History_History.prototype.newItem, arguments);
    };
    __History_History.prototype.__class__.newItem.unbound_method = true;
    __History_History.prototype.newItem.instance_method = true;
    __History_History.prototype.onHistoryChanged = function(historyToken) {
    this.fireHistoryChangedImpl(historyToken);
    };
    __History_History.prototype.__class__.onHistoryChanged = function() {
        return __History_History.prototype.onHistoryChanged.call.apply(__History_History.prototype.onHistoryChanged, arguments);
    };
    __History_History.prototype.__class__.onHistoryChanged.unbound_method = true;
    __History_History.prototype.onHistoryChanged.instance_method = true;
    __History_History.prototype.fireHistoryChangedAndCatch = function() {
    };
    __History_History.prototype.__class__.fireHistoryChangedAndCatch = function() {
        return __History_History.prototype.fireHistoryChangedAndCatch.call.apply(__History_History.prototype.fireHistoryChangedAndCatch, arguments);
    };
    __History_History.prototype.__class__.fireHistoryChangedAndCatch.unbound_method = true;
    __History_History.prototype.fireHistoryChangedAndCatch.instance_method = true;
    __History_History.prototype.fireHistoryChangedImpl = function(historyToken) {

        var __listener = History_historyListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onHistoryChanged(historyToken);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __History_History.prototype.__class__.fireHistoryChangedImpl = function() {
        return __History_History.prototype.fireHistoryChangedImpl.call.apply(__History_History.prototype.fireHistoryChangedImpl, arguments);
    };
    __History_History.prototype.__class__.fireHistoryChangedImpl.unbound_method = true;
    __History_History.prototype.fireHistoryChangedImpl.instance_method = true;
    __History_History.prototype.removeHistoryListener = function(listener) {
    History_historyListeners.remove(listener);
    };
    __History_History.prototype.__class__.removeHistoryListener = function() {
        return __History_History.prototype.removeHistoryListener.call.apply(__History_History.prototype.removeHistoryListener, arguments);
    };
    __History_History.prototype.__class__.removeHistoryListener.unbound_method = true;
    __History_History.prototype.removeHistoryListener.instance_method = true;
}
__History_History_initialize();
function __ui_Event() {
}
function ui_Event() {
    var instance = new __ui_Event();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Event_initialize() {
    if(__ui_Event.__was_initialized__) return;
    __ui_Event.__was_initialized__ = true;
    pyjs_extend(__ui_Event, __pyjslib_Object);
    __ui_Event.prototype.__class__.__new__ = ui_Event;
    __ui_Event.prototype.__class__.BUTTON_LEFT = 1;
    __ui_Event.prototype.__class__.BUTTON_MIDDLE = 4;
    __ui_Event.prototype.__class__.BUTTON_RIGHT = 2;
    __ui_Event.prototype.__class__.ONBLUR = 4096;
    __ui_Event.prototype.__class__.ONCHANGE = 1024;
    __ui_Event.prototype.__class__.ONCLICK = 1;
    __ui_Event.prototype.__class__.ONDBLCLICK = 2;
    __ui_Event.prototype.__class__.ONERROR = 65536;
    __ui_Event.prototype.__class__.ONFOCUS = 2048;
    __ui_Event.prototype.__class__.ONKEYDOWN = 128;
    __ui_Event.prototype.__class__.ONKEYPRESS = 256;
    __ui_Event.prototype.__class__.ONKEYUP = 512;
    __ui_Event.prototype.__class__.ONLOAD = 32768;
    __ui_Event.prototype.__class__.ONLOSECAPTURE = 8192;
    __ui_Event.prototype.__class__.ONMOUSEDOWN = 4;
    __ui_Event.prototype.__class__.ONMOUSEMOVE = 64;
    __ui_Event.prototype.__class__.ONMOUSEOUT = 32;
    __ui_Event.prototype.__class__.ONMOUSEOVER = 16;
    __ui_Event.prototype.__class__.ONMOUSEUP = 8;
    __ui_Event.prototype.__class__.ONSCROLL = 16384;
    __ui_Event.prototype.__class__.FOCUSEVENTS = 6144;
    __ui_Event.prototype.__class__.KEYEVENTS = 896;
    __ui_Event.prototype.__class__.MOUSEEVENTS = 124;
}
function __ui_FocusListener() {
}
function ui_FocusListener() {
    var instance = new __ui_FocusListener();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FocusListener_initialize() {
    if(__ui_FocusListener.__was_initialized__) return;
    __ui_FocusListener.__was_initialized__ = true;
    pyjs_extend(__ui_FocusListener, __pyjslib_Object);
    __ui_FocusListener.prototype.__class__.__new__ = ui_FocusListener;
    __ui_FocusListener.prototype.fireFocusEvent = function(listeners, sender, event) {
    var type = DOM_eventGetType(event);
    if ((type == 'focus')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onFocus(sender);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'blur')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onLostFocus(sender);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_FocusListener.prototype.__class__.fireFocusEvent = function() {
        return __ui_FocusListener.prototype.fireFocusEvent.call.apply(__ui_FocusListener.prototype.fireFocusEvent, arguments);
    };
    __ui_FocusListener.prototype.__class__.fireFocusEvent.unbound_method = true;
    __ui_FocusListener.prototype.fireFocusEvent.instance_method = true;
}
function __ui_KeyboardListener() {
}
function ui_KeyboardListener() {
    var instance = new __ui_KeyboardListener();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_KeyboardListener_initialize() {
    if(__ui_KeyboardListener.__was_initialized__) return;
    __ui_KeyboardListener.__was_initialized__ = true;
    pyjs_extend(__ui_KeyboardListener, __pyjslib_Object);
    __ui_KeyboardListener.prototype.__class__.__new__ = ui_KeyboardListener;
    __ui_KeyboardListener.prototype.__class__.KEY_ALT = 18;
    __ui_KeyboardListener.prototype.__class__.KEY_BACKSPACE = 8;
    __ui_KeyboardListener.prototype.__class__.KEY_CTRL = 17;
    __ui_KeyboardListener.prototype.__class__.KEY_DELETE = 46;
    __ui_KeyboardListener.prototype.__class__.KEY_DOWN = 40;
    __ui_KeyboardListener.prototype.__class__.KEY_END = 35;
    __ui_KeyboardListener.prototype.__class__.KEY_ENTER = 13;
    __ui_KeyboardListener.prototype.__class__.KEY_ESCAPE = 27;
    __ui_KeyboardListener.prototype.__class__.KEY_HOME = 36;
    __ui_KeyboardListener.prototype.__class__.KEY_LEFT = 37;
    __ui_KeyboardListener.prototype.__class__.KEY_PAGEDOWN = 34;
    __ui_KeyboardListener.prototype.__class__.KEY_PAGEUP = 33;
    __ui_KeyboardListener.prototype.__class__.KEY_RIGHT = 39;
    __ui_KeyboardListener.prototype.__class__.KEY_SHIFT = 16;
    __ui_KeyboardListener.prototype.__class__.KEY_TAB = 9;
    __ui_KeyboardListener.prototype.__class__.KEY_UP = 38;
    __ui_KeyboardListener.prototype.__class__.MODIFIER_ALT = 4;
    __ui_KeyboardListener.prototype.__class__.MODIFIER_CTRL = 2;
    __ui_KeyboardListener.prototype.__class__.MODIFIER_SHIFT = 1;
    __ui_KeyboardListener.prototype.getKeyboardModifiers = function(event) {
    var shift = 0;
    var ctrl = 0;
    var alt = 0;
    if (DOM_eventGetShiftKey(event)) {
    var shift = __ui_KeyboardListener.prototype.__class__.MODIFIER_SHIFT;
    }
    if (DOM_eventGetCtrlKey(event)) {
    var ctrl = __ui_KeyboardListener.prototype.__class__.MODIFIER_CTRL;
    }
    if (DOM_eventGetAltKey(event)) {
    var alt = __ui_KeyboardListener.prototype.__class__.MODIFIER_ALT;
    }
    return (shift | ctrl | alt);
    };
    __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers = function() {
        return __ui_KeyboardListener.prototype.getKeyboardModifiers.call.apply(__ui_KeyboardListener.prototype.getKeyboardModifiers, arguments);
    };
    __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers.unbound_method = true;
    __ui_KeyboardListener.prototype.getKeyboardModifiers.instance_method = true;
    __ui_KeyboardListener.prototype.fireKeyboardEvent = function(listeners, sender, event) {
    var modifiers = __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers(this, event);
    var type = DOM_eventGetType(event);
    if ((type == 'keydown')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onKeyDown(sender, DOM_eventGetKeyCode(event), modifiers);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'keyup')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onKeyUp(sender, DOM_eventGetKeyCode(event), modifiers);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'keypress')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onKeyPress(sender, DOM_eventGetKeyCode(event), modifiers);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent = function() {
        return __ui_KeyboardListener.prototype.fireKeyboardEvent.call.apply(__ui_KeyboardListener.prototype.fireKeyboardEvent, arguments);
    };
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent.unbound_method = true;
    __ui_KeyboardListener.prototype.fireKeyboardEvent.instance_method = true;
}
function __ui_MouseListener() {
}
function ui_MouseListener() {
    var instance = new __ui_MouseListener();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_MouseListener_initialize() {
    if(__ui_MouseListener.__was_initialized__) return;
    __ui_MouseListener.__was_initialized__ = true;
    pyjs_extend(__ui_MouseListener, __pyjslib_Object);
    __ui_MouseListener.prototype.__class__.__new__ = ui_MouseListener;
    __ui_MouseListener.prototype.fireMouseEvent = function(listeners, sender, event) {
    var x =  ( DOM_eventGetClientX(event) - DOM_getAbsoluteLeft(sender.getElement()) ) ;
    var y =  ( DOM_eventGetClientY(event) - DOM_getAbsoluteTop(sender.getElement()) ) ;
    var type = DOM_eventGetType(event);
    if ((type == 'mousedown')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseDown(sender, x, y);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'mouseup')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseUp(sender, x, y);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'mousemove')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseMove(sender, x, y);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'mouseover')) {
    var from_element = DOM_eventGetFromElement(event);
    if (!(DOM_isOrHasChild(sender.getElement(), from_element))) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseEnter(sender);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    }
    else if ((type == 'mouseout')) {
    var to_element = DOM_eventGetToElement(event);
    if (!(DOM_isOrHasChild(sender.getElement(), to_element))) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseLeave(sender);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    }
    };
    __ui_MouseListener.prototype.__class__.fireMouseEvent = function() {
        return __ui_MouseListener.prototype.fireMouseEvent.call.apply(__ui_MouseListener.prototype.fireMouseEvent, arguments);
    };
    __ui_MouseListener.prototype.__class__.fireMouseEvent.unbound_method = true;
    __ui_MouseListener.prototype.fireMouseEvent.instance_method = true;
}
function __ui_UIObject() {
}
function ui_UIObject() {
    var instance = new __ui_UIObject();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_UIObject_initialize() {
    if(__ui_UIObject.__was_initialized__) return;
    __ui_UIObject.__was_initialized__ = true;
    pyjs_extend(__ui_UIObject, __pyjslib_Object);
    __ui_UIObject.prototype.__class__.__new__ = ui_UIObject;
    __ui_UIObject.prototype.getAbsoluteLeft = function() {
    return DOM_getAbsoluteLeft(this.getElement());
    };
    __ui_UIObject.prototype.__class__.getAbsoluteLeft = function() {
        return __ui_UIObject.prototype.getAbsoluteLeft.call.apply(__ui_UIObject.prototype.getAbsoluteLeft, arguments);
    };
    __ui_UIObject.prototype.__class__.getAbsoluteLeft.unbound_method = true;
    __ui_UIObject.prototype.getAbsoluteLeft.instance_method = true;
    __ui_UIObject.prototype.getAbsoluteTop = function() {
    return DOM_getAbsoluteTop(this.getElement());
    };
    __ui_UIObject.prototype.__class__.getAbsoluteTop = function() {
        return __ui_UIObject.prototype.getAbsoluteTop.call.apply(__ui_UIObject.prototype.getAbsoluteTop, arguments);
    };
    __ui_UIObject.prototype.__class__.getAbsoluteTop.unbound_method = true;
    __ui_UIObject.prototype.getAbsoluteTop.instance_method = true;
    __ui_UIObject.prototype.getElement = function() {
    return this.element;
    };
    __ui_UIObject.prototype.__class__.getElement = function() {
        return __ui_UIObject.prototype.getElement.call.apply(__ui_UIObject.prototype.getElement, arguments);
    };
    __ui_UIObject.prototype.__class__.getElement.unbound_method = true;
    __ui_UIObject.prototype.getElement.instance_method = true;
    __ui_UIObject.prototype.getOffsetHeight = function() {
    return DOM_getIntAttribute(this.element, 'offsetHeight');
    };
    __ui_UIObject.prototype.__class__.getOffsetHeight = function() {
        return __ui_UIObject.prototype.getOffsetHeight.call.apply(__ui_UIObject.prototype.getOffsetHeight, arguments);
    };
    __ui_UIObject.prototype.__class__.getOffsetHeight.unbound_method = true;
    __ui_UIObject.prototype.getOffsetHeight.instance_method = true;
    __ui_UIObject.prototype.getOffsetWidth = function() {
    return DOM_getIntAttribute(this.element, 'offsetWidth');
    };
    __ui_UIObject.prototype.__class__.getOffsetWidth = function() {
        return __ui_UIObject.prototype.getOffsetWidth.call.apply(__ui_UIObject.prototype.getOffsetWidth, arguments);
    };
    __ui_UIObject.prototype.__class__.getOffsetWidth.unbound_method = true;
    __ui_UIObject.prototype.getOffsetWidth.instance_method = true;
    __ui_UIObject.prototype.getStyleName = function() {
    return DOM_getAttribute(this.element, 'className');
    };
    __ui_UIObject.prototype.__class__.getStyleName = function() {
        return __ui_UIObject.prototype.getStyleName.call.apply(__ui_UIObject.prototype.getStyleName, arguments);
    };
    __ui_UIObject.prototype.__class__.getStyleName.unbound_method = true;
    __ui_UIObject.prototype.getStyleName.instance_method = true;
    __ui_UIObject.prototype.getTitle = function() {
    return DOM_getAttribute(this.element, 'title');
    };
    __ui_UIObject.prototype.__class__.getTitle = function() {
        return __ui_UIObject.prototype.getTitle.call.apply(__ui_UIObject.prototype.getTitle, arguments);
    };
    __ui_UIObject.prototype.__class__.getTitle.unbound_method = true;
    __ui_UIObject.prototype.getTitle.instance_method = true;
    __ui_UIObject.prototype.setElement = function(element) {
    this.element = element;
    };
    __ui_UIObject.prototype.__class__.setElement = function() {
        return __ui_UIObject.prototype.setElement.call.apply(__ui_UIObject.prototype.setElement, arguments);
    };
    __ui_UIObject.prototype.__class__.setElement.unbound_method = true;
    __ui_UIObject.prototype.setElement.instance_method = true;
    __ui_UIObject.prototype.setHeight = function(height) {
    DOM_setStyleAttribute(this.element, 'height', height);
    };
    __ui_UIObject.prototype.__class__.setHeight = function() {
        return __ui_UIObject.prototype.setHeight.call.apply(__ui_UIObject.prototype.setHeight, arguments);
    };
    __ui_UIObject.prototype.__class__.setHeight.unbound_method = true;
    __ui_UIObject.prototype.setHeight.instance_method = true;
    __ui_UIObject.prototype.getHeight = function() {
    return DOM_getStyleAttribute(this.element, 'height');
    };
    __ui_UIObject.prototype.__class__.getHeight = function() {
        return __ui_UIObject.prototype.getHeight.call.apply(__ui_UIObject.prototype.getHeight, arguments);
    };
    __ui_UIObject.prototype.__class__.getHeight.unbound_method = true;
    __ui_UIObject.prototype.getHeight.instance_method = true;
    __ui_UIObject.prototype.setPixelSize = function(width, height) {
    if ((width >= 0)) {
    this.setWidth( ( width + 'px' ) );
    }
    if ((height >= 0)) {
    this.setHeight( ( height + 'px' ) );
    }
    };
    __ui_UIObject.prototype.__class__.setPixelSize = function() {
        return __ui_UIObject.prototype.setPixelSize.call.apply(__ui_UIObject.prototype.setPixelSize, arguments);
    };
    __ui_UIObject.prototype.__class__.setPixelSize.unbound_method = true;
    __ui_UIObject.prototype.setPixelSize.instance_method = true;
    __ui_UIObject.prototype.setSize = function(width, height) {
    this.setWidth(width);
    this.setHeight(height);
    };
    __ui_UIObject.prototype.__class__.setSize = function() {
        return __ui_UIObject.prototype.setSize.call.apply(__ui_UIObject.prototype.setSize, arguments);
    };
    __ui_UIObject.prototype.__class__.setSize.unbound_method = true;
    __ui_UIObject.prototype.setSize.instance_method = true;
    __ui_UIObject.prototype.addStyleName = function(style) {
    this.setStyleName(this.element, style, true);
    };
    __ui_UIObject.prototype.__class__.addStyleName = function() {
        return __ui_UIObject.prototype.addStyleName.call.apply(__ui_UIObject.prototype.addStyleName, arguments);
    };
    __ui_UIObject.prototype.__class__.addStyleName.unbound_method = true;
    __ui_UIObject.prototype.addStyleName.instance_method = true;
    __ui_UIObject.prototype.removeStyleName = function(style) {
    this.setStyleName(this.element, style, false);
    };
    __ui_UIObject.prototype.__class__.removeStyleName = function() {
        return __ui_UIObject.prototype.removeStyleName.call.apply(__ui_UIObject.prototype.removeStyleName, arguments);
    };
    __ui_UIObject.prototype.__class__.removeStyleName.unbound_method = true;
    __ui_UIObject.prototype.removeStyleName.instance_method = true;
    __ui_UIObject.prototype.setStyleName = function(element, style, add) {
    if (typeof style == 'undefined') style=null;
    if (typeof add == 'undefined') add=true;
    if ((style == null)) {
    var style = element;
    DOM_setAttribute(this.element, 'className', style);
    return;
    }
    var oldStyle = DOM_getAttribute(element, 'className');
    if ((oldStyle == null)) {
    var oldStyle = '';
    }
    var idx = oldStyle.find(style);
    var lastPos = pyjslib_len(oldStyle);
    while ((idx != -1)) {
    if (((idx == 0)) || ((oldStyle.__getitem__( ( idx - 1 ) ) == ' '))) {
    var last =  ( idx + pyjslib_len(style) ) ;
    if (((last == lastPos)) || (((last < lastPos)) && ((oldStyle.__getitem__(last) == ' ')))) {
    break;
    }
    }
    var idx = oldStyle.find(style,  ( idx + 1 ) );
    }
    if (add) {
    if ((idx == -1)) {
    DOM_setAttribute(element, 'className',  (  ( oldStyle + ' ' )  + style ) );
    }
    }
    else {
    if ((idx != -1)) {
    var begin = pyjslib_slice(oldStyle, null, idx);
    var end = pyjslib_slice(oldStyle,  ( idx + pyjslib_len(style) ) , null);
    DOM_setAttribute(element, 'className',  ( begin + end ) );
    }
    }
    };
__ui_UIObject.prototype.setStyleName.parse_kwargs = function ( __kwargs, element, style, add ) {
    if (typeof style == 'undefined')
        style=__kwargs.style;
    if (typeof add == 'undefined')
        add=__kwargs.add;
    var __r = [element, style, add];
    return __r;
};
    __ui_UIObject.prototype.__class__.setStyleName = function() {
        return __ui_UIObject.prototype.setStyleName.call.apply(__ui_UIObject.prototype.setStyleName, arguments);
    };
    __ui_UIObject.prototype.__class__.setStyleName.unbound_method = true;
    __ui_UIObject.prototype.setStyleName.instance_method = true;
    __ui_UIObject.prototype.__class__.setStyleName.parse_kwargs = __ui_UIObject.prototype.setStyleName.parse_kwargs;
    __ui_UIObject.prototype.setTitle = function(title) {
    DOM_setAttribute(this.element, 'title', title);
    };
    __ui_UIObject.prototype.__class__.setTitle = function() {
        return __ui_UIObject.prototype.setTitle.call.apply(__ui_UIObject.prototype.setTitle, arguments);
    };
    __ui_UIObject.prototype.__class__.setTitle.unbound_method = true;
    __ui_UIObject.prototype.setTitle.instance_method = true;
    __ui_UIObject.prototype.setWidth = function(width) {
    DOM_setStyleAttribute(this.element, 'width', width);
    };
    __ui_UIObject.prototype.__class__.setWidth = function() {
        return __ui_UIObject.prototype.setWidth.call.apply(__ui_UIObject.prototype.setWidth, arguments);
    };
    __ui_UIObject.prototype.__class__.setWidth.unbound_method = true;
    __ui_UIObject.prototype.setWidth.instance_method = true;
    __ui_UIObject.prototype.getWidth = function() {
    return DOM_getStyleAttribute(this.element, 'width');
    };
    __ui_UIObject.prototype.__class__.getWidth = function() {
        return __ui_UIObject.prototype.getWidth.call.apply(__ui_UIObject.prototype.getWidth, arguments);
    };
    __ui_UIObject.prototype.__class__.getWidth.unbound_method = true;
    __ui_UIObject.prototype.getWidth.instance_method = true;
    __ui_UIObject.prototype.sinkEvents = function(eventBitsToAdd) {
    if (this.element) {
    DOM_sinkEvents(this.getElement(), (eventBitsToAdd | DOM_getEventsSunk(this.getElement())));
    }
    };
    __ui_UIObject.prototype.__class__.sinkEvents = function() {
        return __ui_UIObject.prototype.sinkEvents.call.apply(__ui_UIObject.prototype.sinkEvents, arguments);
    };
    __ui_UIObject.prototype.__class__.sinkEvents.unbound_method = true;
    __ui_UIObject.prototype.sinkEvents.instance_method = true;
    __ui_UIObject.prototype.setzIndex = function(index) {
    DOM_setIntStyleAttribute(this.element, 'zIndex', index);
    };
    __ui_UIObject.prototype.__class__.setzIndex = function() {
        return __ui_UIObject.prototype.setzIndex.call.apply(__ui_UIObject.prototype.setzIndex, arguments);
    };
    __ui_UIObject.prototype.__class__.setzIndex.unbound_method = true;
    __ui_UIObject.prototype.setzIndex.instance_method = true;
    __ui_UIObject.prototype.isVisible = function(element) {
    if (typeof element == 'undefined') element=null;
    if (!(element)) {
    var element = this.element;
    }
    return (element.style.display != 'none');
    };
__ui_UIObject.prototype.isVisible.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
    __ui_UIObject.prototype.__class__.isVisible = function() {
        return __ui_UIObject.prototype.isVisible.call.apply(__ui_UIObject.prototype.isVisible, arguments);
    };
    __ui_UIObject.prototype.__class__.isVisible.unbound_method = true;
    __ui_UIObject.prototype.isVisible.instance_method = true;
    __ui_UIObject.prototype.__class__.isVisible.parse_kwargs = __ui_UIObject.prototype.isVisible.parse_kwargs;
    __ui_UIObject.prototype.setVisible = function(element, visible) {
    if (typeof visible == 'undefined') visible=null;
    if ((visible == null)) {
    var visible = element;
    var element = this.element;
    }
    if (visible) {
    element.style.display = '';
    }
    else {
    element.style.display = 'none';
    }
    };
__ui_UIObject.prototype.setVisible.parse_kwargs = function ( __kwargs, element, visible ) {
    if (typeof visible == 'undefined')
        visible=__kwargs.visible;
    var __r = [element, visible];
    return __r;
};
    __ui_UIObject.prototype.__class__.setVisible = function() {
        return __ui_UIObject.prototype.setVisible.call.apply(__ui_UIObject.prototype.setVisible, arguments);
    };
    __ui_UIObject.prototype.__class__.setVisible.unbound_method = true;
    __ui_UIObject.prototype.setVisible.instance_method = true;
    __ui_UIObject.prototype.__class__.setVisible.parse_kwargs = __ui_UIObject.prototype.setVisible.parse_kwargs;
    __ui_UIObject.prototype.unsinkEvents = function(eventBitsToRemove) {
    DOM_sinkEvents(this.getElement(), (~eventBitsToRemove & DOM_getEventsSunk(this.getElement())));
    };
    __ui_UIObject.prototype.__class__.unsinkEvents = function() {
        return __ui_UIObject.prototype.unsinkEvents.call.apply(__ui_UIObject.prototype.unsinkEvents, arguments);
    };
    __ui_UIObject.prototype.__class__.unsinkEvents.unbound_method = true;
    __ui_UIObject.prototype.unsinkEvents.instance_method = true;
}
function __ui_Widget() {
}
function ui_Widget() {
    var instance = new __ui_Widget();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Widget_initialize() {
    if(__ui_Widget.__was_initialized__) return;
    __ui_Widget.__was_initialized__ = true;
    if(!__ui_UIObject.__was_initialized__)
        __ui_UIObject_initialize();
    pyjs_extend(__ui_Widget, __ui_UIObject);
    __ui_Widget.prototype.__class__.__new__ = ui_Widget;
    __ui_Widget.prototype.__init__ = function() {
    this.attached = false;
    this.parent = null;
    this.layoutData = null;
    };
    __ui_Widget.prototype.__class__.__init__ = function() {
        return __ui_Widget.prototype.__init__.call.apply(__ui_Widget.prototype.__init__, arguments);
    };
    __ui_Widget.prototype.__class__.__init__.unbound_method = true;
    __ui_Widget.prototype.__init__.instance_method = true;
    __ui_Widget.prototype.getLayoutData = function() {
    return this.layoutData;
    };
    __ui_Widget.prototype.__class__.getLayoutData = function() {
        return __ui_Widget.prototype.getLayoutData.call.apply(__ui_Widget.prototype.getLayoutData, arguments);
    };
    __ui_Widget.prototype.__class__.getLayoutData.unbound_method = true;
    __ui_Widget.prototype.getLayoutData.instance_method = true;
    __ui_Widget.prototype.getParent = function() {
    return this.parent;
    };
    __ui_Widget.prototype.__class__.getParent = function() {
        return __ui_Widget.prototype.getParent.call.apply(__ui_Widget.prototype.getParent, arguments);
    };
    __ui_Widget.prototype.__class__.getParent.unbound_method = true;
    __ui_Widget.prototype.getParent.instance_method = true;
    __ui_Widget.prototype.isAttached = function() {
    return this.attached;
    };
    __ui_Widget.prototype.__class__.isAttached = function() {
        return __ui_Widget.prototype.isAttached.call.apply(__ui_Widget.prototype.isAttached, arguments);
    };
    __ui_Widget.prototype.__class__.isAttached.unbound_method = true;
    __ui_Widget.prototype.isAttached.instance_method = true;
    __ui_Widget.prototype.onBrowserEvent = function(event) {
    };
    __ui_Widget.prototype.__class__.onBrowserEvent = function() {
        return __ui_Widget.prototype.onBrowserEvent.call.apply(__ui_Widget.prototype.onBrowserEvent, arguments);
    };
    __ui_Widget.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Widget.prototype.onBrowserEvent.instance_method = true;
    __ui_Widget.prototype.onLoad = function() {
    };
    __ui_Widget.prototype.__class__.onLoad = function() {
        return __ui_Widget.prototype.onLoad.call.apply(__ui_Widget.prototype.onLoad, arguments);
    };
    __ui_Widget.prototype.__class__.onLoad.unbound_method = true;
    __ui_Widget.prototype.onLoad.instance_method = true;
    __ui_Widget.prototype.doDetachChildren = function() {
    };
    __ui_Widget.prototype.__class__.doDetachChildren = function() {
        return __ui_Widget.prototype.doDetachChildren.call.apply(__ui_Widget.prototype.doDetachChildren, arguments);
    };
    __ui_Widget.prototype.__class__.doDetachChildren.unbound_method = true;
    __ui_Widget.prototype.doDetachChildren.instance_method = true;
    __ui_Widget.prototype.doAttachChildren = function() {
    };
    __ui_Widget.prototype.__class__.doAttachChildren = function() {
        return __ui_Widget.prototype.doAttachChildren.call.apply(__ui_Widget.prototype.doAttachChildren, arguments);
    };
    __ui_Widget.prototype.__class__.doAttachChildren.unbound_method = true;
    __ui_Widget.prototype.doAttachChildren.instance_method = true;
    __ui_Widget.prototype.onAttach = function() {
    if (this.isAttached()) {
    return;
    }
    this.attached = true;
    DOM_setEventListener(this.getElement(), this);
    this.doAttachChildren();
    this.onLoad();
    };
    __ui_Widget.prototype.__class__.onAttach = function() {
        return __ui_Widget.prototype.onAttach.call.apply(__ui_Widget.prototype.onAttach, arguments);
    };
    __ui_Widget.prototype.__class__.onAttach.unbound_method = true;
    __ui_Widget.prototype.onAttach.instance_method = true;
    __ui_Widget.prototype.onDetach = function() {
    if (!(this.isAttached())) {
    return;
    }
    this.doDetachChildren();
    this.attached = false;
    DOM_setEventListener(this.getElement(), null);
    };
    __ui_Widget.prototype.__class__.onDetach = function() {
        return __ui_Widget.prototype.onDetach.call.apply(__ui_Widget.prototype.onDetach, arguments);
    };
    __ui_Widget.prototype.__class__.onDetach.unbound_method = true;
    __ui_Widget.prototype.onDetach.instance_method = true;
    __ui_Widget.prototype.setLayoutData = function(layoutData) {
    this.layoutData = layoutData;
    };
    __ui_Widget.prototype.__class__.setLayoutData = function() {
        return __ui_Widget.prototype.setLayoutData.call.apply(__ui_Widget.prototype.setLayoutData, arguments);
    };
    __ui_Widget.prototype.__class__.setLayoutData.unbound_method = true;
    __ui_Widget.prototype.setLayoutData.instance_method = true;
    __ui_Widget.prototype.setParent = function(parent) {
    var oldparent = this.parent;
    this.parent = parent;
    if ((parent == null)) {
    if (((oldparent != null)) && (oldparent.attached)) {
    this.onDetach();
    }
    }
    else if (parent.attached) {
    this.onAttach();
    }
    };
    __ui_Widget.prototype.__class__.setParent = function() {
        return __ui_Widget.prototype.setParent.call.apply(__ui_Widget.prototype.setParent, arguments);
    };
    __ui_Widget.prototype.__class__.setParent.unbound_method = true;
    __ui_Widget.prototype.setParent.instance_method = true;
    __ui_Widget.prototype.removeFromParent = function() {
    if (pyjslib_hasattr(this.parent, 'remove')) {
    this.parent.remove(this);
    }
    };
    __ui_Widget.prototype.__class__.removeFromParent = function() {
        return __ui_Widget.prototype.removeFromParent.call.apply(__ui_Widget.prototype.removeFromParent, arguments);
    };
    __ui_Widget.prototype.__class__.removeFromParent.unbound_method = true;
    __ui_Widget.prototype.removeFromParent.instance_method = true;
    __ui_Widget.prototype.getID = function() {
    return DOM_getAttribute(this.getElement(), 'id');
    };
    __ui_Widget.prototype.__class__.getID = function() {
        return __ui_Widget.prototype.getID.call.apply(__ui_Widget.prototype.getID, arguments);
    };
    __ui_Widget.prototype.__class__.getID.unbound_method = true;
    __ui_Widget.prototype.getID.instance_method = true;
    __ui_Widget.prototype.setID = function(id) {
    DOM_setAttribute(this.getElement(), 'id', id);
    };
    __ui_Widget.prototype.__class__.setID = function() {
        return __ui_Widget.prototype.setID.call.apply(__ui_Widget.prototype.setID, arguments);
    };
    __ui_Widget.prototype.__class__.setID.unbound_method = true;
    __ui_Widget.prototype.setID.instance_method = true;
}
function __ui_FocusWidget() {
}
function ui_FocusWidget(element) {
    var instance = new __ui_FocusWidget();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FocusWidget_initialize() {
    if(__ui_FocusWidget.__was_initialized__) return;
    __ui_FocusWidget.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_FocusWidget, __ui_Widget);
    __ui_FocusWidget.prototype.__class__.__new__ = ui_FocusWidget;
    __ui_FocusWidget.prototype.__init__ = function(element) {
    __ui_Widget.prototype.__class__.__init__(this);
    this.clickListeners = new pyjslib_List([]);
    this.focusListeners = new pyjslib_List([]);
    this.keyboardListeners = new pyjslib_List([]);
    this.setElement(element);
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.FOCUSEVENTS | __ui_Event.prototype.__class__.KEYEVENTS));
    };
    __ui_FocusWidget.prototype.__class__.__init__ = function() {
        return __ui_FocusWidget.prototype.__init__.call.apply(__ui_FocusWidget.prototype.__init__, arguments);
    };
    __ui_FocusWidget.prototype.__class__.__init__.unbound_method = true;
    __ui_FocusWidget.prototype.__init__.instance_method = true;
    __ui_FocusWidget.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_FocusWidget.prototype.__class__.addClickListener = function() {
        return __ui_FocusWidget.prototype.addClickListener.call.apply(__ui_FocusWidget.prototype.addClickListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.addClickListener.unbound_method = true;
    __ui_FocusWidget.prototype.addClickListener.instance_method = true;
    __ui_FocusWidget.prototype.addFocusListener = function(listener) {
    this.focusListeners.append(listener);
    };
    __ui_FocusWidget.prototype.__class__.addFocusListener = function() {
        return __ui_FocusWidget.prototype.addFocusListener.call.apply(__ui_FocusWidget.prototype.addFocusListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.addFocusListener.unbound_method = true;
    __ui_FocusWidget.prototype.addFocusListener.instance_method = true;
    __ui_FocusWidget.prototype.addKeyboardListener = function(listener) {
    this.keyboardListeners.append(listener);
    };
    __ui_FocusWidget.prototype.__class__.addKeyboardListener = function() {
        return __ui_FocusWidget.prototype.addKeyboardListener.call.apply(__ui_FocusWidget.prototype.addKeyboardListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.addKeyboardListener.unbound_method = true;
    __ui_FocusWidget.prototype.addKeyboardListener.instance_method = true;
    __ui_FocusWidget.prototype.getTabIndex = function() {
    return __ui_Focus.prototype.__class__.getTabIndex(this, this.getElement());
    };
    __ui_FocusWidget.prototype.__class__.getTabIndex = function() {
        return __ui_FocusWidget.prototype.getTabIndex.call.apply(__ui_FocusWidget.prototype.getTabIndex, arguments);
    };
    __ui_FocusWidget.prototype.__class__.getTabIndex.unbound_method = true;
    __ui_FocusWidget.prototype.getTabIndex.instance_method = true;
    __ui_FocusWidget.prototype.isEnabled = function() {
    return !(DOM_getBooleanAttribute(this.getElement(), 'disabled'));
    };
    __ui_FocusWidget.prototype.__class__.isEnabled = function() {
        return __ui_FocusWidget.prototype.isEnabled.call.apply(__ui_FocusWidget.prototype.isEnabled, arguments);
    };
    __ui_FocusWidget.prototype.__class__.isEnabled.unbound_method = true;
    __ui_FocusWidget.prototype.isEnabled.instance_method = true;
    __ui_FocusWidget.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (pyjslib_hasattr(listener, 'onClick')) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if (((type == 'blur')) || ((type == 'focus'))) {
    __ui_FocusListener.prototype.__class__.fireFocusEvent(this, this.focusListeners, this, event);
    }
    else if (((type == 'keydown')) || ((type == 'keypress')) || ((type == 'keyup'))) {
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent(this, this.keyboardListeners, this, event);
    }
    };
    __ui_FocusWidget.prototype.__class__.onBrowserEvent = function() {
        return __ui_FocusWidget.prototype.onBrowserEvent.call.apply(__ui_FocusWidget.prototype.onBrowserEvent, arguments);
    };
    __ui_FocusWidget.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_FocusWidget.prototype.onBrowserEvent.instance_method = true;
    __ui_FocusWidget.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_FocusWidget.prototype.__class__.removeClickListener = function() {
        return __ui_FocusWidget.prototype.removeClickListener.call.apply(__ui_FocusWidget.prototype.removeClickListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_FocusWidget.prototype.removeClickListener.instance_method = true;
    __ui_FocusWidget.prototype.removeFocusListener = function(listener) {
    this.focusListeners.remove(listener);
    };
    __ui_FocusWidget.prototype.__class__.removeFocusListener = function() {
        return __ui_FocusWidget.prototype.removeFocusListener.call.apply(__ui_FocusWidget.prototype.removeFocusListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.removeFocusListener.unbound_method = true;
    __ui_FocusWidget.prototype.removeFocusListener.instance_method = true;
    __ui_FocusWidget.prototype.removeKeyboardListener = function(listener) {
    this.keyboardListeners.remove(listener);
    };
    __ui_FocusWidget.prototype.__class__.removeKeyboardListener = function() {
        return __ui_FocusWidget.prototype.removeKeyboardListener.call.apply(__ui_FocusWidget.prototype.removeKeyboardListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.removeKeyboardListener.unbound_method = true;
    __ui_FocusWidget.prototype.removeKeyboardListener.instance_method = true;
    __ui_FocusWidget.prototype.setAccessKey = function(key) {
    DOM_setAttribute(this.getElement(), 'accessKey',  ( '' + key ) );
    };
    __ui_FocusWidget.prototype.__class__.setAccessKey = function() {
        return __ui_FocusWidget.prototype.setAccessKey.call.apply(__ui_FocusWidget.prototype.setAccessKey, arguments);
    };
    __ui_FocusWidget.prototype.__class__.setAccessKey.unbound_method = true;
    __ui_FocusWidget.prototype.setAccessKey.instance_method = true;
    __ui_FocusWidget.prototype.setEnabled = function(enabled) {
    DOM_setBooleanAttribute(this.getElement(), 'disabled', !(enabled));
    };
    __ui_FocusWidget.prototype.__class__.setEnabled = function() {
        return __ui_FocusWidget.prototype.setEnabled.call.apply(__ui_FocusWidget.prototype.setEnabled, arguments);
    };
    __ui_FocusWidget.prototype.__class__.setEnabled.unbound_method = true;
    __ui_FocusWidget.prototype.setEnabled.instance_method = true;
    __ui_FocusWidget.prototype.setFocus = function(focused) {
    if (focused) {
    __ui_Focus.prototype.__class__.focus(this, this.getElement());
    }
    else {
    __ui_Focus.prototype.__class__.blur(this, this.getElement());
    }
    };
    __ui_FocusWidget.prototype.__class__.setFocus = function() {
        return __ui_FocusWidget.prototype.setFocus.call.apply(__ui_FocusWidget.prototype.setFocus, arguments);
    };
    __ui_FocusWidget.prototype.__class__.setFocus.unbound_method = true;
    __ui_FocusWidget.prototype.setFocus.instance_method = true;
    __ui_FocusWidget.prototype.setTabIndex = function(index) {
    __ui_Focus.prototype.__class__.setTabIndex(this, this.getElement(), index);
    };
    __ui_FocusWidget.prototype.__class__.setTabIndex = function() {
        return __ui_FocusWidget.prototype.setTabIndex.call.apply(__ui_FocusWidget.prototype.setTabIndex, arguments);
    };
    __ui_FocusWidget.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_FocusWidget.prototype.setTabIndex.instance_method = true;
}
function __ui_ButtonBase() {
}
function ui_ButtonBase(element) {
    var instance = new __ui_ButtonBase();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ButtonBase_initialize() {
    if(__ui_ButtonBase.__was_initialized__) return;
    __ui_ButtonBase.__was_initialized__ = true;
    if(!__ui_FocusWidget.__was_initialized__)
        __ui_FocusWidget_initialize();
    pyjs_extend(__ui_ButtonBase, __ui_FocusWidget);
    __ui_ButtonBase.prototype.__class__.__new__ = ui_ButtonBase;
    __ui_ButtonBase.prototype.__init__ = function(element) {
    __ui_FocusWidget.prototype.__class__.__init__(this, element);
    };
    __ui_ButtonBase.prototype.__class__.__init__ = function() {
        return __ui_ButtonBase.prototype.__init__.call.apply(__ui_ButtonBase.prototype.__init__, arguments);
    };
    __ui_ButtonBase.prototype.__class__.__init__.unbound_method = true;
    __ui_ButtonBase.prototype.__init__.instance_method = true;
    __ui_ButtonBase.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.getElement());
    };
    __ui_ButtonBase.prototype.__class__.getHTML = function() {
        return __ui_ButtonBase.prototype.getHTML.call.apply(__ui_ButtonBase.prototype.getHTML, arguments);
    };
    __ui_ButtonBase.prototype.__class__.getHTML.unbound_method = true;
    __ui_ButtonBase.prototype.getHTML.instance_method = true;
    __ui_ButtonBase.prototype.getText = function() {
    return DOM_getInnerText(this.getElement());
    };
    __ui_ButtonBase.prototype.__class__.getText = function() {
        return __ui_ButtonBase.prototype.getText.call.apply(__ui_ButtonBase.prototype.getText, arguments);
    };
    __ui_ButtonBase.prototype.__class__.getText.unbound_method = true;
    __ui_ButtonBase.prototype.getText.instance_method = true;
    __ui_ButtonBase.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.getElement(), html);
    };
    __ui_ButtonBase.prototype.__class__.setHTML = function() {
        return __ui_ButtonBase.prototype.setHTML.call.apply(__ui_ButtonBase.prototype.setHTML, arguments);
    };
    __ui_ButtonBase.prototype.__class__.setHTML.unbound_method = true;
    __ui_ButtonBase.prototype.setHTML.instance_method = true;
    __ui_ButtonBase.prototype.setText = function(text) {
    DOM_setInnerText(this.getElement(), text);
    };
    __ui_ButtonBase.prototype.__class__.setText = function() {
        return __ui_ButtonBase.prototype.setText.call.apply(__ui_ButtonBase.prototype.setText, arguments);
    };
    __ui_ButtonBase.prototype.__class__.setText.unbound_method = true;
    __ui_ButtonBase.prototype.setText.instance_method = true;
}
function __ui_Button() {
}
function ui_Button(html, listener) {
    if (typeof html == 'undefined') html=null;
    if (typeof listener == 'undefined') listener=null;
    var instance = new __ui_Button();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Button.parse_kwargs = function ( __kwargs, html, listener ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    if (typeof listener == 'undefined')
        listener=__kwargs.listener;
    var __r = [html, listener];
    return __r;
};
function __ui_Button_initialize() {
    if(__ui_Button.__was_initialized__) return;
    __ui_Button.__was_initialized__ = true;
    if(!__ui_ButtonBase.__was_initialized__)
        __ui_ButtonBase_initialize();
    pyjs_extend(__ui_Button, __ui_ButtonBase);
    __ui_Button.prototype.__class__.__new__ = ui_Button;
    __ui_Button.prototype.__init__ = function(html, listener) {
    if (typeof html == 'undefined') html=null;
    if (typeof listener == 'undefined') listener=null;
    __ui_ButtonBase.prototype.__class__.__init__(this, DOM_createButton());
    this.adjustType(this.getElement());
    this.setStyleName('gwt-Button');
    if (html) {
    this.setHTML(html);
    }
    if (listener) {
    this.addClickListener(listener);
    }
    };
__ui_Button.prototype.__init__.parse_kwargs = function ( __kwargs, html, listener ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    if (typeof listener == 'undefined')
        listener=__kwargs.listener;
    var __r = [html, listener];
    return __r;
};
    __ui_Button.prototype.__class__.__init__ = function() {
        return __ui_Button.prototype.__init__.call.apply(__ui_Button.prototype.__init__, arguments);
    };
    __ui_Button.prototype.__class__.__init__.unbound_method = true;
    __ui_Button.prototype.__init__.instance_method = true;
    __ui_Button.prototype.__class__.__init__.parse_kwargs = __ui_Button.prototype.__init__.parse_kwargs;
    __ui_Button.prototype.adjustType = function(button) {

        if (button.type == 'submit') {
            try { button.setAttribute("type", "button"); } catch (e) { }
        }
        
    };
    __ui_Button.prototype.__class__.adjustType = function() {
        return __ui_Button.prototype.adjustType.call.apply(__ui_Button.prototype.adjustType, arguments);
    };
    __ui_Button.prototype.__class__.adjustType.unbound_method = true;
    __ui_Button.prototype.adjustType.instance_method = true;
    __ui_Button.prototype.click = function() {
    this.getElement().click();
    };
    __ui_Button.prototype.__class__.click = function() {
        return __ui_Button.prototype.click.call.apply(__ui_Button.prototype.click, arguments);
    };
    __ui_Button.prototype.__class__.click.unbound_method = true;
    __ui_Button.prototype.click.instance_method = true;
}
function __ui_CheckBox() {
}
function ui_CheckBox(label, asHTML) {
    if (typeof label == 'undefined') label=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    var instance = new __ui_CheckBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_CheckBox.parse_kwargs = function ( __kwargs, label, asHTML ) {
    if (typeof label == 'undefined')
        label=__kwargs.label;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [label, asHTML];
    return __r;
};
function __ui_CheckBox_initialize() {
    if(__ui_CheckBox.__was_initialized__) return;
    __ui_CheckBox.__was_initialized__ = true;
    if(!__ui_ButtonBase.__was_initialized__)
        __ui_ButtonBase_initialize();
    pyjs_extend(__ui_CheckBox, __ui_ButtonBase);
    __ui_CheckBox.prototype.__class__.__new__ = ui_CheckBox;
    __ui_CheckBox.prototype.__init__ = function(label, asHTML) {
    if (typeof label == 'undefined') label=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    this.initElement(DOM_createInputCheck());
    this.setStyleName('gwt-CheckBox');
    if (label) {
    if (asHTML) {
    this.setHTML(label);
    }
    else {
    this.setText(label);
    }
    }
    };
__ui_CheckBox.prototype.__init__.parse_kwargs = function ( __kwargs, label, asHTML ) {
    if (typeof label == 'undefined')
        label=__kwargs.label;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [label, asHTML];
    return __r;
};
    __ui_CheckBox.prototype.__class__.__init__ = function() {
        return __ui_CheckBox.prototype.__init__.call.apply(__ui_CheckBox.prototype.__init__, arguments);
    };
    __ui_CheckBox.prototype.__class__.__init__.unbound_method = true;
    __ui_CheckBox.prototype.__init__.instance_method = true;
    __ui_CheckBox.prototype.__class__.__init__.parse_kwargs = __ui_CheckBox.prototype.__init__.parse_kwargs;
    __ui_CheckBox.prototype.initElement = function(element) {
    __ui_ButtonBase.prototype.__class__.__init__(this, DOM_createSpan());
    this.inputElem = element;
    this.labelElem = DOM_createLabel();
    this.unsinkEvents((__ui_Event.prototype.__class__.FOCUSEVENTS | __ui_Event.prototype.__class__.ONCLICK));
    DOM_sinkEvents(this.inputElem, (__ui_Event.prototype.__class__.FOCUSEVENTS | __ui_Event.prototype.__class__.ONCLICK | DOM_getEventsSunk(this.inputElem)));
    DOM_appendChild(this.getElement(), this.inputElem);
    DOM_appendChild(this.getElement(), this.labelElem);
    var uid =  ( 'check' + this.getUniqueID() ) ;
    DOM_setAttribute(this.inputElem, 'id', uid);
    DOM_setAttribute(this.labelElem, 'htmlFor', uid);
    };
    __ui_CheckBox.prototype.__class__.initElement = function() {
        return __ui_CheckBox.prototype.initElement.call.apply(__ui_CheckBox.prototype.initElement, arguments);
    };
    __ui_CheckBox.prototype.__class__.initElement.unbound_method = true;
    __ui_CheckBox.prototype.initElement.instance_method = true;
    __ui_CheckBox.prototype.getUniqueID = function() {

        _CheckBox_unique_id++;
        return _CheckBox_unique_id;
        };
        var _CheckBox_unique_id=0;
        {
        
    };
    __ui_CheckBox.prototype.__class__.getUniqueID = function() {
        return __ui_CheckBox.prototype.getUniqueID.call.apply(__ui_CheckBox.prototype.getUniqueID, arguments);
    };
    __ui_CheckBox.prototype.__class__.getUniqueID.unbound_method = true;
    __ui_CheckBox.prototype.getUniqueID.instance_method = true;
    __ui_CheckBox.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.labelElem);
    };
    __ui_CheckBox.prototype.__class__.getHTML = function() {
        return __ui_CheckBox.prototype.getHTML.call.apply(__ui_CheckBox.prototype.getHTML, arguments);
    };
    __ui_CheckBox.prototype.__class__.getHTML.unbound_method = true;
    __ui_CheckBox.prototype.getHTML.instance_method = true;
    __ui_CheckBox.prototype.getName = function() {
    return DOM_getAttribute(this.inputElem, 'name');
    };
    __ui_CheckBox.prototype.__class__.getName = function() {
        return __ui_CheckBox.prototype.getName.call.apply(__ui_CheckBox.prototype.getName, arguments);
    };
    __ui_CheckBox.prototype.__class__.getName.unbound_method = true;
    __ui_CheckBox.prototype.getName.instance_method = true;
    __ui_CheckBox.prototype.getText = function() {
    return DOM_getInnerText(this.labelElem);
    };
    __ui_CheckBox.prototype.__class__.getText = function() {
        return __ui_CheckBox.prototype.getText.call.apply(__ui_CheckBox.prototype.getText, arguments);
    };
    __ui_CheckBox.prototype.__class__.getText.unbound_method = true;
    __ui_CheckBox.prototype.getText.instance_method = true;
    __ui_CheckBox.prototype.setChecked = function(checked) {
    DOM_setBooleanAttribute(this.inputElem, 'checked', checked);
    DOM_setBooleanAttribute(this.inputElem, 'defaultChecked', checked);
    };
    __ui_CheckBox.prototype.__class__.setChecked = function() {
        return __ui_CheckBox.prototype.setChecked.call.apply(__ui_CheckBox.prototype.setChecked, arguments);
    };
    __ui_CheckBox.prototype.__class__.setChecked.unbound_method = true;
    __ui_CheckBox.prototype.setChecked.instance_method = true;
    __ui_CheckBox.prototype.isChecked = function() {
    if (this.isAttached()) {
    var propName = 'checked';
    }
    else {
    var propName = 'defaultChecked';
    }
    return DOM_getBooleanAttribute(this.inputElem, propName);
    };
    __ui_CheckBox.prototype.__class__.isChecked = function() {
        return __ui_CheckBox.prototype.isChecked.call.apply(__ui_CheckBox.prototype.isChecked, arguments);
    };
    __ui_CheckBox.prototype.__class__.isChecked.unbound_method = true;
    __ui_CheckBox.prototype.isChecked.instance_method = true;
    __ui_CheckBox.prototype.isEnabled = function() {
    return !(DOM_getBooleanAttribute(this.inputElem, 'disabled'));
    };
    __ui_CheckBox.prototype.__class__.isEnabled = function() {
        return __ui_CheckBox.prototype.isEnabled.call.apply(__ui_CheckBox.prototype.isEnabled, arguments);
    };
    __ui_CheckBox.prototype.__class__.isEnabled.unbound_method = true;
    __ui_CheckBox.prototype.isEnabled.instance_method = true;
    __ui_CheckBox.prototype.setEnabled = function(enabled) {
    DOM_setBooleanAttribute(this.inputElem, 'disabled', !(enabled));
    };
    __ui_CheckBox.prototype.__class__.setEnabled = function() {
        return __ui_CheckBox.prototype.setEnabled.call.apply(__ui_CheckBox.prototype.setEnabled, arguments);
    };
    __ui_CheckBox.prototype.__class__.setEnabled.unbound_method = true;
    __ui_CheckBox.prototype.setEnabled.instance_method = true;
    __ui_CheckBox.prototype.setFocus = function(focused) {
    if (focused) {
    __ui_Focus.prototype.__class__.focus(this, this.inputElem);
    }
    else {
    __ui_Focus.prototype.__class__.blur(this, this.inputElem);
    }
    };
    __ui_CheckBox.prototype.__class__.setFocus = function() {
        return __ui_CheckBox.prototype.setFocus.call.apply(__ui_CheckBox.prototype.setFocus, arguments);
    };
    __ui_CheckBox.prototype.__class__.setFocus.unbound_method = true;
    __ui_CheckBox.prototype.setFocus.instance_method = true;
    __ui_CheckBox.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.labelElem, html);
    };
    __ui_CheckBox.prototype.__class__.setHTML = function() {
        return __ui_CheckBox.prototype.setHTML.call.apply(__ui_CheckBox.prototype.setHTML, arguments);
    };
    __ui_CheckBox.prototype.__class__.setHTML.unbound_method = true;
    __ui_CheckBox.prototype.setHTML.instance_method = true;
    __ui_CheckBox.prototype.setName = function(name) {
    DOM_setAttribute(this.inputElem, 'name', name);
    };
    __ui_CheckBox.prototype.__class__.setName = function() {
        return __ui_CheckBox.prototype.setName.call.apply(__ui_CheckBox.prototype.setName, arguments);
    };
    __ui_CheckBox.prototype.__class__.setName.unbound_method = true;
    __ui_CheckBox.prototype.setName.instance_method = true;
    __ui_CheckBox.prototype.setTabIndex = function(index) {
    __ui_Focus.prototype.__class__.setTabIndex(this, this.inputElem, index);
    };
    __ui_CheckBox.prototype.__class__.setTabIndex = function() {
        return __ui_CheckBox.prototype.setTabIndex.call.apply(__ui_CheckBox.prototype.setTabIndex, arguments);
    };
    __ui_CheckBox.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_CheckBox.prototype.setTabIndex.instance_method = true;
    __ui_CheckBox.prototype.setText = function(text) {
    DOM_setInnerText(this.labelElem, text);
    };
    __ui_CheckBox.prototype.__class__.setText = function() {
        return __ui_CheckBox.prototype.setText.call.apply(__ui_CheckBox.prototype.setText, arguments);
    };
    __ui_CheckBox.prototype.__class__.setText.unbound_method = true;
    __ui_CheckBox.prototype.setText.instance_method = true;
    __ui_CheckBox.prototype.onDetach = function() {
    this.setChecked(this.isChecked());
    __ui_ButtonBase.prototype.__class__.onDetach(this);
    };
    __ui_CheckBox.prototype.__class__.onDetach = function() {
        return __ui_CheckBox.prototype.onDetach.call.apply(__ui_CheckBox.prototype.onDetach, arguments);
    };
    __ui_CheckBox.prototype.__class__.onDetach.unbound_method = true;
    __ui_CheckBox.prototype.onDetach.instance_method = true;
}
function __ui_RadioButton() {
}
function ui_RadioButton(group, label, asHTML) {
    if (typeof label == 'undefined') label=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    var instance = new __ui_RadioButton();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_RadioButton.parse_kwargs = function ( __kwargs, group, label, asHTML ) {
    if (typeof label == 'undefined')
        label=__kwargs.label;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [group, label, asHTML];
    return __r;
};
function __ui_RadioButton_initialize() {
    if(__ui_RadioButton.__was_initialized__) return;
    __ui_RadioButton.__was_initialized__ = true;
    if(!__ui_CheckBox.__was_initialized__)
        __ui_CheckBox_initialize();
    pyjs_extend(__ui_RadioButton, __ui_CheckBox);
    __ui_RadioButton.prototype.__class__.__new__ = ui_RadioButton;
    __ui_RadioButton.prototype.__init__ = function(group, label, asHTML) {
    if (typeof label == 'undefined') label=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    this.initElement(DOM_createInputRadio(group));
    this.setStyleName('gwt-RadioButton');
    if (label) {
    if (asHTML) {
    this.setHTML(label);
    }
    else {
    this.setText(label);
    }
    }
    };
__ui_RadioButton.prototype.__init__.parse_kwargs = function ( __kwargs, group, label, asHTML ) {
    if (typeof label == 'undefined')
        label=__kwargs.label;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [group, label, asHTML];
    return __r;
};
    __ui_RadioButton.prototype.__class__.__init__ = function() {
        return __ui_RadioButton.prototype.__init__.call.apply(__ui_RadioButton.prototype.__init__, arguments);
    };
    __ui_RadioButton.prototype.__class__.__init__.unbound_method = true;
    __ui_RadioButton.prototype.__init__.instance_method = true;
    __ui_RadioButton.prototype.__class__.__init__.parse_kwargs = __ui_RadioButton.prototype.__init__.parse_kwargs;
}
function __ui_Composite() {
}
function ui_Composite() {
    var instance = new __ui_Composite();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Composite_initialize() {
    if(__ui_Composite.__was_initialized__) return;
    __ui_Composite.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Composite, __ui_Widget);
    __ui_Composite.prototype.__class__.__new__ = ui_Composite;
    __ui_Composite.prototype.__init__ = function() {
    __ui_Widget.prototype.__class__.__init__(this);
    this.widget = null;
    };
    __ui_Composite.prototype.__class__.__init__ = function() {
        return __ui_Composite.prototype.__init__.call.apply(__ui_Composite.prototype.__init__, arguments);
    };
    __ui_Composite.prototype.__class__.__init__.unbound_method = true;
    __ui_Composite.prototype.__init__.instance_method = true;
    __ui_Composite.prototype.initWidget = function(widget) {
    if ((this.widget != null)) {
    return;
    }
    widget.removeFromParent();
    this.setElement(widget.getElement());
    this.widget = widget;
    widget.setParent(this);
    };
    __ui_Composite.prototype.__class__.initWidget = function() {
        return __ui_Composite.prototype.initWidget.call.apply(__ui_Composite.prototype.initWidget, arguments);
    };
    __ui_Composite.prototype.__class__.initWidget.unbound_method = true;
    __ui_Composite.prototype.initWidget.instance_method = true;
    __ui_Composite.prototype.isAttached = function() {
    if (this.widget) {
    return this.widget.isAttached();
    }
    return false;
    };
    __ui_Composite.prototype.__class__.isAttached = function() {
        return __ui_Composite.prototype.isAttached.call.apply(__ui_Composite.prototype.isAttached, arguments);
    };
    __ui_Composite.prototype.__class__.isAttached.unbound_method = true;
    __ui_Composite.prototype.isAttached.instance_method = true;
    __ui_Composite.prototype.onAttach = function() {
    this.widget.onAttach();
    DOM_setEventListener(this.getElement(), this);
    this.onLoad();
    };
    __ui_Composite.prototype.__class__.onAttach = function() {
        return __ui_Composite.prototype.onAttach.call.apply(__ui_Composite.prototype.onAttach, arguments);
    };
    __ui_Composite.prototype.__class__.onAttach.unbound_method = true;
    __ui_Composite.prototype.onAttach.instance_method = true;
    __ui_Composite.prototype.onDetach = function() {
    this.widget.onDetach();
    };
    __ui_Composite.prototype.__class__.onDetach = function() {
        return __ui_Composite.prototype.onDetach.call.apply(__ui_Composite.prototype.onDetach, arguments);
    };
    __ui_Composite.prototype.__class__.onDetach.unbound_method = true;
    __ui_Composite.prototype.onDetach.instance_method = true;
    __ui_Composite.prototype.setWidget = function(widget) {
    this.initWidget(widget);
    };
    __ui_Composite.prototype.__class__.setWidget = function() {
        return __ui_Composite.prototype.setWidget.call.apply(__ui_Composite.prototype.setWidget, arguments);
    };
    __ui_Composite.prototype.__class__.setWidget.unbound_method = true;
    __ui_Composite.prototype.setWidget.instance_method = true;
    __ui_Composite.prototype.onBrowserEvent = function(event) {
    this.widget.onBrowserEvent(event);
    };
    __ui_Composite.prototype.__class__.onBrowserEvent = function() {
        return __ui_Composite.prototype.onBrowserEvent.call.apply(__ui_Composite.prototype.onBrowserEvent, arguments);
    };
    __ui_Composite.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Composite.prototype.onBrowserEvent.instance_method = true;
}
function __ui_Panel() {
}
function ui_Panel() {
    var instance = new __ui_Panel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Panel_initialize() {
    if(__ui_Panel.__was_initialized__) return;
    __ui_Panel.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Panel, __ui_Widget);
    __ui_Panel.prototype.__class__.__new__ = ui_Panel;
    __ui_Panel.prototype.__init__ = function() {
    __ui_Widget.prototype.__class__.__init__(this);
    this.children = new pyjslib_List([]);
    };
    __ui_Panel.prototype.__class__.__init__ = function() {
        return __ui_Panel.prototype.__init__.call.apply(__ui_Panel.prototype.__init__, arguments);
    };
    __ui_Panel.prototype.__class__.__init__.unbound_method = true;
    __ui_Panel.prototype.__init__.instance_method = true;
    __ui_Panel.prototype.add = function() {
    console.error('This panel does not support no-arg add()');
    };
    __ui_Panel.prototype.__class__.add = function() {
        return __ui_Panel.prototype.add.call.apply(__ui_Panel.prototype.add, arguments);
    };
    __ui_Panel.prototype.__class__.add.unbound_method = true;
    __ui_Panel.prototype.add.instance_method = true;
    __ui_Panel.prototype.clear = function() {
    var children = new pyjslib_List([]);

        var __child = this.children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    children.append(child);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

        var __child = children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    this.remove(child);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Panel.prototype.__class__.clear = function() {
        return __ui_Panel.prototype.clear.call.apply(__ui_Panel.prototype.clear, arguments);
    };
    __ui_Panel.prototype.__class__.clear.unbound_method = true;
    __ui_Panel.prototype.clear.instance_method = true;
    __ui_Panel.prototype.disown = function(widget) {
    if ((widget.getParent() != this)) {
    console.error('widget %o is not a child of this panel %o', widget, this);
    }
    else {
    var element = widget.getElement();
    widget.setParent(null);
    var parentElement = DOM_getParent(element);
    if (parentElement) {
    DOM_removeChild(parentElement, element);
    }
    }
    };
    __ui_Panel.prototype.__class__.disown = function() {
        return __ui_Panel.prototype.disown.call.apply(__ui_Panel.prototype.disown, arguments);
    };
    __ui_Panel.prototype.__class__.disown.unbound_method = true;
    __ui_Panel.prototype.disown.instance_method = true;
    __ui_Panel.prototype.adopt = function(widget, container) {
    if (container) {
    widget.removeFromParent();
    DOM_appendChild(container, widget.getElement());
    }
    widget.setParent(this);
    };
    __ui_Panel.prototype.__class__.adopt = function() {
        return __ui_Panel.prototype.adopt.call.apply(__ui_Panel.prototype.adopt, arguments);
    };
    __ui_Panel.prototype.__class__.adopt.unbound_method = true;
    __ui_Panel.prototype.adopt.instance_method = true;
    __ui_Panel.prototype.remove = function(widget) {
    };
    __ui_Panel.prototype.__class__.remove = function() {
        return __ui_Panel.prototype.remove.call.apply(__ui_Panel.prototype.remove, arguments);
    };
    __ui_Panel.prototype.__class__.remove.unbound_method = true;
    __ui_Panel.prototype.remove.instance_method = true;
    __ui_Panel.prototype.doAttachChildren = function() {

        var __child = this.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.onAttach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Panel.prototype.__class__.doAttachChildren = function() {
        return __ui_Panel.prototype.doAttachChildren.call.apply(__ui_Panel.prototype.doAttachChildren, arguments);
    };
    __ui_Panel.prototype.__class__.doAttachChildren.unbound_method = true;
    __ui_Panel.prototype.doAttachChildren.instance_method = true;
    __ui_Panel.prototype.doDetachChildren = function() {

        var __child = this.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.onDetach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Panel.prototype.__class__.doDetachChildren = function() {
        return __ui_Panel.prototype.doDetachChildren.call.apply(__ui_Panel.prototype.doDetachChildren, arguments);
    };
    __ui_Panel.prototype.__class__.doDetachChildren.unbound_method = true;
    __ui_Panel.prototype.doDetachChildren.instance_method = true;
    __ui_Panel.prototype.__iter__ = function() {
    return this.children.__iter__();
    };
    __ui_Panel.prototype.__class__.__iter__ = function() {
        return __ui_Panel.prototype.__iter__.call.apply(__ui_Panel.prototype.__iter__, arguments);
    };
    __ui_Panel.prototype.__class__.__iter__.unbound_method = true;
    __ui_Panel.prototype.__iter__.instance_method = true;
}
function __ui_CellFormatter() {
}
function ui_CellFormatter(outer) {
    var instance = new __ui_CellFormatter();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_CellFormatter_initialize() {
    if(__ui_CellFormatter.__was_initialized__) return;
    __ui_CellFormatter.__was_initialized__ = true;
    pyjs_extend(__ui_CellFormatter, __pyjslib_Object);
    __ui_CellFormatter.prototype.__class__.__new__ = ui_CellFormatter;
    __ui_CellFormatter.prototype.__init__ = function(outer) {
    this.outer = outer;
    };
    __ui_CellFormatter.prototype.__class__.__init__ = function() {
        return __ui_CellFormatter.prototype.__init__.call.apply(__ui_CellFormatter.prototype.__init__, arguments);
    };
    __ui_CellFormatter.prototype.__class__.__init__.unbound_method = true;
    __ui_CellFormatter.prototype.__init__.instance_method = true;
    __ui_CellFormatter.prototype.addStyleName = function(row, column, styleName) {
    this.outer.prepareCell(row, column);
    this.outer.setStyleName(this.getElement(row, column), styleName, true);
    };
    __ui_CellFormatter.prototype.__class__.addStyleName = function() {
        return __ui_CellFormatter.prototype.addStyleName.call.apply(__ui_CellFormatter.prototype.addStyleName, arguments);
    };
    __ui_CellFormatter.prototype.__class__.addStyleName.unbound_method = true;
    __ui_CellFormatter.prototype.addStyleName.instance_method = true;
    __ui_CellFormatter.prototype.getElement = function(row, column) {
    this.outer.checkCellBounds(row, column);
    return DOM_getChild(this.outer.rowFormatter.getRow(this.outer.bodyElem, row), column);
    };
    __ui_CellFormatter.prototype.__class__.getElement = function() {
        return __ui_CellFormatter.prototype.getElement.call.apply(__ui_CellFormatter.prototype.getElement, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getElement.unbound_method = true;
    __ui_CellFormatter.prototype.getElement.instance_method = true;
    __ui_CellFormatter.prototype.getStyleName = function(row, column) {
    return DOM_getAttribute(this.getElement(row, column), 'className');
    };
    __ui_CellFormatter.prototype.__class__.getStyleName = function() {
        return __ui_CellFormatter.prototype.getStyleName.call.apply(__ui_CellFormatter.prototype.getStyleName, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getStyleName.unbound_method = true;
    __ui_CellFormatter.prototype.getStyleName.instance_method = true;
    __ui_CellFormatter.prototype.isVisible = function(row, column) {
    var element = this.getElement(row, column);
    return this.outer.isVisible(element);
    };
    __ui_CellFormatter.prototype.__class__.isVisible = function() {
        return __ui_CellFormatter.prototype.isVisible.call.apply(__ui_CellFormatter.prototype.isVisible, arguments);
    };
    __ui_CellFormatter.prototype.__class__.isVisible.unbound_method = true;
    __ui_CellFormatter.prototype.isVisible.instance_method = true;
    __ui_CellFormatter.prototype.removeStyleName = function(row, column, styleName) {
    this.outer.checkCellBounds(row, column);
    this.outer.setStyleName(this.getElement(row, column), styleName, false);
    };
    __ui_CellFormatter.prototype.__class__.removeStyleName = function() {
        return __ui_CellFormatter.prototype.removeStyleName.call.apply(__ui_CellFormatter.prototype.removeStyleName, arguments);
    };
    __ui_CellFormatter.prototype.__class__.removeStyleName.unbound_method = true;
    __ui_CellFormatter.prototype.removeStyleName.instance_method = true;
    __ui_CellFormatter.prototype.setAlignment = function(row, column, hAlign, vAlign) {
    this.setHorizontalAlignment(row, column, hAlign);
    this.setVerticalAlignment(row, column, vAlign);
    };
    __ui_CellFormatter.prototype.__class__.setAlignment = function() {
        return __ui_CellFormatter.prototype.setAlignment.call.apply(__ui_CellFormatter.prototype.setAlignment, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setAlignment.unbound_method = true;
    __ui_CellFormatter.prototype.setAlignment.instance_method = true;
    __ui_CellFormatter.prototype.setHeight = function(row, column, height) {
    this.outer.prepareCell(row, column);
    var element = this.getCellElement(this.outer.bodyElem, row, column);
    DOM_setStyleAttribute(element, 'height', height);
    };
    __ui_CellFormatter.prototype.__class__.setHeight = function() {
        return __ui_CellFormatter.prototype.setHeight.call.apply(__ui_CellFormatter.prototype.setHeight, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setHeight.unbound_method = true;
    __ui_CellFormatter.prototype.setHeight.instance_method = true;
    __ui_CellFormatter.prototype.setHorizontalAlignment = function(row, column, align) {
    this.outer.prepareCell(row, column);
    var element = this.getCellElement(this.outer.bodyElem, row, column);
    DOM_setAttribute(element, 'align', align);
    };
    __ui_CellFormatter.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_CellFormatter.prototype.setHorizontalAlignment.call.apply(__ui_CellFormatter.prototype.setHorizontalAlignment, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_CellFormatter.prototype.setHorizontalAlignment.instance_method = true;
    __ui_CellFormatter.prototype.setStyleName = function(row, column, styleName) {
    this.outer.prepareCell(row, column);
    this.setAttr(row, column, 'className', styleName);
    };
    __ui_CellFormatter.prototype.__class__.setStyleName = function() {
        return __ui_CellFormatter.prototype.setStyleName.call.apply(__ui_CellFormatter.prototype.setStyleName, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setStyleName.unbound_method = true;
    __ui_CellFormatter.prototype.setStyleName.instance_method = true;
    __ui_CellFormatter.prototype.setVerticalAlignment = function(row, column, align) {
    this.outer.prepareCell(row, column);
    DOM_setStyleAttribute(this.getCellElement(this.outer.bodyElem, row, column), 'verticalAlign', align);
    };
    __ui_CellFormatter.prototype.__class__.setVerticalAlignment = function() {
        return __ui_CellFormatter.prototype.setVerticalAlignment.call.apply(__ui_CellFormatter.prototype.setVerticalAlignment, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setVerticalAlignment.unbound_method = true;
    __ui_CellFormatter.prototype.setVerticalAlignment.instance_method = true;
    __ui_CellFormatter.prototype.setVisible = function(row, column, visible) {
    var element = this.ensureElement(row, column);
    this.outer.setVisible(element, visible);
    };
    __ui_CellFormatter.prototype.__class__.setVisible = function() {
        return __ui_CellFormatter.prototype.setVisible.call.apply(__ui_CellFormatter.prototype.setVisible, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setVisible.unbound_method = true;
    __ui_CellFormatter.prototype.setVisible.instance_method = true;
    __ui_CellFormatter.prototype.setWidth = function(row, column, width) {
    this.outer.prepareCell(row, column);
    DOM_setStyleAttribute(this.getCellElement(this.outer.bodyElem, row, column), 'width', width);
    };
    __ui_CellFormatter.prototype.__class__.setWidth = function() {
        return __ui_CellFormatter.prototype.setWidth.call.apply(__ui_CellFormatter.prototype.setWidth, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setWidth.unbound_method = true;
    __ui_CellFormatter.prototype.setWidth.instance_method = true;
    __ui_CellFormatter.prototype.setWordWrap = function(row, column, wrap) {
    this.outer.prepareCell(row, column);
    if (wrap) {
    var wrap_str = '';
    }
    else {
    var wrap_str = 'nowrap';
    }
    DOM_setStyleAttribute(this.getElement(row, column), 'whiteSpace', wrap_str);
    };
    __ui_CellFormatter.prototype.__class__.setWordWrap = function() {
        return __ui_CellFormatter.prototype.setWordWrap.call.apply(__ui_CellFormatter.prototype.setWordWrap, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setWordWrap.unbound_method = true;
    __ui_CellFormatter.prototype.setWordWrap.instance_method = true;
    __ui_CellFormatter.prototype.getCellElement = function(table, row, col) {

        var out = table.rows[row].cells[col];
        return (out == null ? null : out);
        
    };
    __ui_CellFormatter.prototype.__class__.getCellElement = function() {
        return __ui_CellFormatter.prototype.getCellElement.call.apply(__ui_CellFormatter.prototype.getCellElement, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getCellElement.unbound_method = true;
    __ui_CellFormatter.prototype.getCellElement.instance_method = true;
    __ui_CellFormatter.prototype.getRawElement = function(row, column) {
    return this.getCellElement(this.outer.bodyElem, row, column);
    };
    __ui_CellFormatter.prototype.__class__.getRawElement = function() {
        return __ui_CellFormatter.prototype.getRawElement.call.apply(__ui_CellFormatter.prototype.getRawElement, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getRawElement.unbound_method = true;
    __ui_CellFormatter.prototype.getRawElement.instance_method = true;
    __ui_CellFormatter.prototype.ensureElement = function(row, column) {
    this.outer.prepareCell(row, column);
    return DOM_getChild(this.outer.rowFormatter.ensureElement(row), column);
    };
    __ui_CellFormatter.prototype.__class__.ensureElement = function() {
        return __ui_CellFormatter.prototype.ensureElement.call.apply(__ui_CellFormatter.prototype.ensureElement, arguments);
    };
    __ui_CellFormatter.prototype.__class__.ensureElement.unbound_method = true;
    __ui_CellFormatter.prototype.ensureElement.instance_method = true;
    __ui_CellFormatter.prototype.getStyleAttr = function(row, column, attr) {
    var elem = this.getElement(row, column);
    return DOM_getStyleAttribute(elem, attr);
    };
    __ui_CellFormatter.prototype.__class__.getStyleAttr = function() {
        return __ui_CellFormatter.prototype.getStyleAttr.call.apply(__ui_CellFormatter.prototype.getStyleAttr, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getStyleAttr.unbound_method = true;
    __ui_CellFormatter.prototype.getStyleAttr.instance_method = true;
    __ui_CellFormatter.prototype.setStyleAttr = function(row, column, attrName, value) {
    var elem = this.getElement(row, column);
    DOM_setStyleAttribute(elem, attrName, value);
    };
    __ui_CellFormatter.prototype.__class__.setStyleAttr = function() {
        return __ui_CellFormatter.prototype.setStyleAttr.call.apply(__ui_CellFormatter.prototype.setStyleAttr, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setStyleAttr.unbound_method = true;
    __ui_CellFormatter.prototype.setStyleAttr.instance_method = true;
    __ui_CellFormatter.prototype.getAttr = function(row, column, attr) {
    var elem = this.getElement(row, column);
    return DOM_getAttribute(elem, attr);
    };
    __ui_CellFormatter.prototype.__class__.getAttr = function() {
        return __ui_CellFormatter.prototype.getAttr.call.apply(__ui_CellFormatter.prototype.getAttr, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getAttr.unbound_method = true;
    __ui_CellFormatter.prototype.getAttr.instance_method = true;
    __ui_CellFormatter.prototype.setAttr = function(row, column, attrName, value) {
    var elem = this.getElement(row, column);
    DOM_setAttribute(elem, attrName, value);
    };
    __ui_CellFormatter.prototype.__class__.setAttr = function() {
        return __ui_CellFormatter.prototype.setAttr.call.apply(__ui_CellFormatter.prototype.setAttr, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setAttr.unbound_method = true;
    __ui_CellFormatter.prototype.setAttr.instance_method = true;
}
function __ui_RowFormatter() {
}
function ui_RowFormatter(outer) {
    var instance = new __ui_RowFormatter();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_RowFormatter_initialize() {
    if(__ui_RowFormatter.__was_initialized__) return;
    __ui_RowFormatter.__was_initialized__ = true;
    pyjs_extend(__ui_RowFormatter, __pyjslib_Object);
    __ui_RowFormatter.prototype.__class__.__new__ = ui_RowFormatter;
    __ui_RowFormatter.prototype.__init__ = function(outer) {
    this.outer = outer;
    };
    __ui_RowFormatter.prototype.__class__.__init__ = function() {
        return __ui_RowFormatter.prototype.__init__.call.apply(__ui_RowFormatter.prototype.__init__, arguments);
    };
    __ui_RowFormatter.prototype.__class__.__init__.unbound_method = true;
    __ui_RowFormatter.prototype.__init__.instance_method = true;
    __ui_RowFormatter.prototype.addStyleName = function(row, styleName) {
    this.outer.setStyleName(this.ensureElement(row), styleName, true);
    };
    __ui_RowFormatter.prototype.__class__.addStyleName = function() {
        return __ui_RowFormatter.prototype.addStyleName.call.apply(__ui_RowFormatter.prototype.addStyleName, arguments);
    };
    __ui_RowFormatter.prototype.__class__.addStyleName.unbound_method = true;
    __ui_RowFormatter.prototype.addStyleName.instance_method = true;
    __ui_RowFormatter.prototype.getElement = function(row) {
    this.outer.checkRowBounds(row);
    return this.getRow(this.outer.bodyElem, row);
    };
    __ui_RowFormatter.prototype.__class__.getElement = function() {
        return __ui_RowFormatter.prototype.getElement.call.apply(__ui_RowFormatter.prototype.getElement, arguments);
    };
    __ui_RowFormatter.prototype.__class__.getElement.unbound_method = true;
    __ui_RowFormatter.prototype.getElement.instance_method = true;
    __ui_RowFormatter.prototype.getStyleName = function(row) {
    return DOM_getAttribute(this.getElement(row), 'className');
    };
    __ui_RowFormatter.prototype.__class__.getStyleName = function() {
        return __ui_RowFormatter.prototype.getStyleName.call.apply(__ui_RowFormatter.prototype.getStyleName, arguments);
    };
    __ui_RowFormatter.prototype.__class__.getStyleName.unbound_method = true;
    __ui_RowFormatter.prototype.getStyleName.instance_method = true;
    __ui_RowFormatter.prototype.isVisible = function(row) {
    var element = this.getElement(row);
    return this.outer.isVisible(element);
    };
    __ui_RowFormatter.prototype.__class__.isVisible = function() {
        return __ui_RowFormatter.prototype.isVisible.call.apply(__ui_RowFormatter.prototype.isVisible, arguments);
    };
    __ui_RowFormatter.prototype.__class__.isVisible.unbound_method = true;
    __ui_RowFormatter.prototype.isVisible.instance_method = true;
    __ui_RowFormatter.prototype.removeStyleName = function(row, styleName) {
    this.outer.setStyleName(this.getElement(row), styleName, false);
    };
    __ui_RowFormatter.prototype.__class__.removeStyleName = function() {
        return __ui_RowFormatter.prototype.removeStyleName.call.apply(__ui_RowFormatter.prototype.removeStyleName, arguments);
    };
    __ui_RowFormatter.prototype.__class__.removeStyleName.unbound_method = true;
    __ui_RowFormatter.prototype.removeStyleName.instance_method = true;
    __ui_RowFormatter.prototype.setStyleName = function(row, styleName) {
    var elem = this.ensureElement(row);
    DOM_setAttribute(elem, 'className', styleName);
    };
    __ui_RowFormatter.prototype.__class__.setStyleName = function() {
        return __ui_RowFormatter.prototype.setStyleName.call.apply(__ui_RowFormatter.prototype.setStyleName, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setStyleName.unbound_method = true;
    __ui_RowFormatter.prototype.setStyleName.instance_method = true;
    __ui_RowFormatter.prototype.setVerticalAlign = function(row, align) {
    DOM_setStyleAttribute(this.ensureElement(row), 'verticalAlign', align);
    };
    __ui_RowFormatter.prototype.__class__.setVerticalAlign = function() {
        return __ui_RowFormatter.prototype.setVerticalAlign.call.apply(__ui_RowFormatter.prototype.setVerticalAlign, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setVerticalAlign.unbound_method = true;
    __ui_RowFormatter.prototype.setVerticalAlign.instance_method = true;
    __ui_RowFormatter.prototype.setVisible = function(row, visible) {
    var element = this.ensureElement(row);
    this.outer.setVisible(element, visible);
    };
    __ui_RowFormatter.prototype.__class__.setVisible = function() {
        return __ui_RowFormatter.prototype.setVisible.call.apply(__ui_RowFormatter.prototype.setVisible, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setVisible.unbound_method = true;
    __ui_RowFormatter.prototype.setVisible.instance_method = true;
    __ui_RowFormatter.prototype.ensureElement = function(row) {
    this.outer.prepareRow(row);
    return this.getRow(this.outer.bodyElem, row);
    };
    __ui_RowFormatter.prototype.__class__.ensureElement = function() {
        return __ui_RowFormatter.prototype.ensureElement.call.apply(__ui_RowFormatter.prototype.ensureElement, arguments);
    };
    __ui_RowFormatter.prototype.__class__.ensureElement.unbound_method = true;
    __ui_RowFormatter.prototype.ensureElement.instance_method = true;
    __ui_RowFormatter.prototype.getRow = function(element, row) {

        return element.rows[row];
        
    };
    __ui_RowFormatter.prototype.__class__.getRow = function() {
        return __ui_RowFormatter.prototype.getRow.call.apply(__ui_RowFormatter.prototype.getRow, arguments);
    };
    __ui_RowFormatter.prototype.__class__.getRow.unbound_method = true;
    __ui_RowFormatter.prototype.getRow.instance_method = true;
    __ui_RowFormatter.prototype.setStyleAttr = function(row, attrName, value) {
    var element = this.ensureElement(row);
    DOM_setStyleAttribute(element, attrName, value);
    };
    __ui_RowFormatter.prototype.__class__.setStyleAttr = function() {
        return __ui_RowFormatter.prototype.setStyleAttr.call.apply(__ui_RowFormatter.prototype.setStyleAttr, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setStyleAttr.unbound_method = true;
    __ui_RowFormatter.prototype.setStyleAttr.instance_method = true;
    __ui_RowFormatter.prototype.setAttr = function(row, attrName, value) {
    var element = this.ensureElement(row);
    DOM_setAttribute(element, attrName, value);
    };
    __ui_RowFormatter.prototype.__class__.setAttr = function() {
        return __ui_RowFormatter.prototype.setAttr.call.apply(__ui_RowFormatter.prototype.setAttr, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setAttr.unbound_method = true;
    __ui_RowFormatter.prototype.setAttr.instance_method = true;
}
function __ui_HTMLTable() {
}
function ui_HTMLTable() {
    var instance = new __ui_HTMLTable();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HTMLTable_initialize() {
    if(__ui_HTMLTable.__was_initialized__) return;
    __ui_HTMLTable.__was_initialized__ = true;
    if(!__ui_Panel.__was_initialized__)
        __ui_Panel_initialize();
    pyjs_extend(__ui_HTMLTable, __ui_Panel);
    __ui_HTMLTable.prototype.__class__.__new__ = ui_HTMLTable;
    __ui_HTMLTable.prototype.__init__ = function() {
    __ui_Panel.prototype.__class__.__init__(this);
    this.cellFormatter = ui_CellFormatter(this);
    this.rowFormatter = ui_RowFormatter(this);
    this.tableListeners = new pyjslib_List([]);
    this.widgetMap = new pyjslib_Dict([]);
    this.tableElem = DOM_createTable();
    this.bodyElem = DOM_createTBody();
    DOM_appendChild(this.tableElem, this.bodyElem);
    this.setElement(this.tableElem);
    this.sinkEvents(__ui_Event.prototype.__class__.ONCLICK);
    };
    __ui_HTMLTable.prototype.__class__.__init__ = function() {
        return __ui_HTMLTable.prototype.__init__.call.apply(__ui_HTMLTable.prototype.__init__, arguments);
    };
    __ui_HTMLTable.prototype.__class__.__init__.unbound_method = true;
    __ui_HTMLTable.prototype.__init__.instance_method = true;
    __ui_HTMLTable.prototype.addTableListener = function(listener) {
    this.tableListeners.append(listener);
    };
    __ui_HTMLTable.prototype.__class__.addTableListener = function() {
        return __ui_HTMLTable.prototype.addTableListener.call.apply(__ui_HTMLTable.prototype.addTableListener, arguments);
    };
    __ui_HTMLTable.prototype.__class__.addTableListener.unbound_method = true;
    __ui_HTMLTable.prototype.addTableListener.instance_method = true;
    __ui_HTMLTable.prototype.clear = function() {

        var __row = pyjslib_range(this.getRowCount()).__iter__();
        try {
            while (true) {
                var row = __row.next();
                
        

        var __col = pyjslib_range(this.getCellCount(row)).__iter__();
        try {
            while (true) {
                var col = __col.next();
                
        
    var child = this.getWidget(row, col);
    if ((child != null)) {
    this.removeWidget(child);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_HTMLTable.prototype.__class__.clear = function() {
        return __ui_HTMLTable.prototype.clear.call.apply(__ui_HTMLTable.prototype.clear, arguments);
    };
    __ui_HTMLTable.prototype.__class__.clear.unbound_method = true;
    __ui_HTMLTable.prototype.clear.instance_method = true;
    __ui_HTMLTable.prototype.clearCell = function(row, column) {
    var td = this.cellFormatter.getElement(row, column);
    return this.internalClearCell(td);
    };
    __ui_HTMLTable.prototype.__class__.clearCell = function() {
        return __ui_HTMLTable.prototype.clearCell.call.apply(__ui_HTMLTable.prototype.clearCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.clearCell.unbound_method = true;
    __ui_HTMLTable.prototype.clearCell.instance_method = true;
    __ui_HTMLTable.prototype.getCellCount = function(row) {
    return 0;
    };
    __ui_HTMLTable.prototype.__class__.getCellCount = function() {
        return __ui_HTMLTable.prototype.getCellCount.call.apply(__ui_HTMLTable.prototype.getCellCount, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getCellCount.unbound_method = true;
    __ui_HTMLTable.prototype.getCellCount.instance_method = true;
    __ui_HTMLTable.prototype.getCellFormatter = function() {
    return this.cellFormatter;
    };
    __ui_HTMLTable.prototype.__class__.getCellFormatter = function() {
        return __ui_HTMLTable.prototype.getCellFormatter.call.apply(__ui_HTMLTable.prototype.getCellFormatter, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getCellFormatter.unbound_method = true;
    __ui_HTMLTable.prototype.getCellFormatter.instance_method = true;
    __ui_HTMLTable.prototype.getCellPadding = function() {
    return DOM_getIntAttribute(this.tableElem, 'cellPadding');
    };
    __ui_HTMLTable.prototype.__class__.getCellPadding = function() {
        return __ui_HTMLTable.prototype.getCellPadding.call.apply(__ui_HTMLTable.prototype.getCellPadding, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getCellPadding.unbound_method = true;
    __ui_HTMLTable.prototype.getCellPadding.instance_method = true;
    __ui_HTMLTable.prototype.getCellSpacing = function() {
    return DOM_getIntAttribute(this.tableElem, 'cellSpacing');
    };
    __ui_HTMLTable.prototype.__class__.getCellSpacing = function() {
        return __ui_HTMLTable.prototype.getCellSpacing.call.apply(__ui_HTMLTable.prototype.getCellSpacing, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getCellSpacing.unbound_method = true;
    __ui_HTMLTable.prototype.getCellSpacing.instance_method = true;
    __ui_HTMLTable.prototype.getHTML = function(row, column) {
    var element = this.cellFormatter.getElement(row, column);
    return DOM_getInnerHTML(element);
    };
    __ui_HTMLTable.prototype.__class__.getHTML = function() {
        return __ui_HTMLTable.prototype.getHTML.call.apply(__ui_HTMLTable.prototype.getHTML, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getHTML.unbound_method = true;
    __ui_HTMLTable.prototype.getHTML.instance_method = true;
    __ui_HTMLTable.prototype.getRowCount = function() {
    return 0;
    };
    __ui_HTMLTable.prototype.__class__.getRowCount = function() {
        return __ui_HTMLTable.prototype.getRowCount.call.apply(__ui_HTMLTable.prototype.getRowCount, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getRowCount.unbound_method = true;
    __ui_HTMLTable.prototype.getRowCount.instance_method = true;
    __ui_HTMLTable.prototype.getRowFormatter = function() {
    return this.rowFormatter;
    };
    __ui_HTMLTable.prototype.__class__.getRowFormatter = function() {
        return __ui_HTMLTable.prototype.getRowFormatter.call.apply(__ui_HTMLTable.prototype.getRowFormatter, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getRowFormatter.unbound_method = true;
    __ui_HTMLTable.prototype.getRowFormatter.instance_method = true;
    __ui_HTMLTable.prototype.getText = function(row, column) {
    this.checkCellBounds(row, column);
    var element = this.cellFormatter.getElement(row, column);
    return DOM_getInnerText(element);
    };
    __ui_HTMLTable.prototype.__class__.getText = function() {
        return __ui_HTMLTable.prototype.getText.call.apply(__ui_HTMLTable.prototype.getText, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getText.unbound_method = true;
    __ui_HTMLTable.prototype.getText.instance_method = true;
    __ui_HTMLTable.prototype.getWidget = function(row, column) {
    if (typeof column == 'undefined') column=null;
    if ((column == null)) {
    var key = this.computeKeyForElement(row);
    }
    else {
    this.checkCellBounds(row, column);
    var key = this.computeKey(row, column);
    }
    if ((key == null)) {
    return;
    }
    return this.widgetMap.__getitem__(key);
    };
__ui_HTMLTable.prototype.getWidget.parse_kwargs = function ( __kwargs, row, column ) {
    if (typeof column == 'undefined')
        column=__kwargs.column;
    var __r = [row, column];
    return __r;
};
    __ui_HTMLTable.prototype.__class__.getWidget = function() {
        return __ui_HTMLTable.prototype.getWidget.call.apply(__ui_HTMLTable.prototype.getWidget, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getWidget.unbound_method = true;
    __ui_HTMLTable.prototype.getWidget.instance_method = true;
    __ui_HTMLTable.prototype.__class__.getWidget.parse_kwargs = __ui_HTMLTable.prototype.getWidget.parse_kwargs;
    __ui_HTMLTable.prototype.isCellPresent = function(row, column) {
    if (((row >= this.getRowCount())) || ((row < 0))) {
    return false;
    }
    if (((column < 0)) || ((column >= this.getCellCount(row)))) {
    return false;
    }
    return true;
    };
    __ui_HTMLTable.prototype.__class__.isCellPresent = function() {
        return __ui_HTMLTable.prototype.isCellPresent.call.apply(__ui_HTMLTable.prototype.isCellPresent, arguments);
    };
    __ui_HTMLTable.prototype.__class__.isCellPresent.unbound_method = true;
    __ui_HTMLTable.prototype.isCellPresent.instance_method = true;
    __ui_HTMLTable.prototype.__iter__ = function() {
    return this.widgetMap.itervalues();
    };
    __ui_HTMLTable.prototype.__class__.__iter__ = function() {
        return __ui_HTMLTable.prototype.__iter__.call.apply(__ui_HTMLTable.prototype.__iter__, arguments);
    };
    __ui_HTMLTable.prototype.__class__.__iter__.unbound_method = true;
    __ui_HTMLTable.prototype.__iter__.instance_method = true;
    __ui_HTMLTable.prototype.onBrowserEvent = function(event) {
    if ((DOM_eventGetType(event) == 'click')) {
    var td = this.getEventTargetCell(event);
    if (!(td)) {
    return;
    }
    var tr = DOM_getParent(td);
    var body = DOM_getParent(tr);
    var row = DOM_getChildIndex(body, tr);
    var column = DOM_getChildIndex(tr, td);

        var __listener = this.tableListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onCellClicked) {
    listener.onCellClicked(this, row, column);
    }
    else {
    listener(this);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_HTMLTable.prototype.__class__.onBrowserEvent = function() {
        return __ui_HTMLTable.prototype.onBrowserEvent.call.apply(__ui_HTMLTable.prototype.onBrowserEvent, arguments);
    };
    __ui_HTMLTable.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_HTMLTable.prototype.onBrowserEvent.instance_method = true;
    __ui_HTMLTable.prototype.remove = function(widget) {
    if ((widget.getParent() != this)) {
    return false;
    }
    this.removeWidget(widget);
    return true;
    };
    __ui_HTMLTable.prototype.__class__.remove = function() {
        return __ui_HTMLTable.prototype.remove.call.apply(__ui_HTMLTable.prototype.remove, arguments);
    };
    __ui_HTMLTable.prototype.__class__.remove.unbound_method = true;
    __ui_HTMLTable.prototype.remove.instance_method = true;
    __ui_HTMLTable.prototype.removeTableListener = function(listener) {
    this.tableListeners.remove(listener);
    };
    __ui_HTMLTable.prototype.__class__.removeTableListener = function() {
        return __ui_HTMLTable.prototype.removeTableListener.call.apply(__ui_HTMLTable.prototype.removeTableListener, arguments);
    };
    __ui_HTMLTable.prototype.__class__.removeTableListener.unbound_method = true;
    __ui_HTMLTable.prototype.removeTableListener.instance_method = true;
    __ui_HTMLTable.prototype.setBorderWidth = function(width) {
    DOM_setAttribute(this.tableElem, 'border', width);
    };
    __ui_HTMLTable.prototype.__class__.setBorderWidth = function() {
        return __ui_HTMLTable.prototype.setBorderWidth.call.apply(__ui_HTMLTable.prototype.setBorderWidth, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setBorderWidth.unbound_method = true;
    __ui_HTMLTable.prototype.setBorderWidth.instance_method = true;
    __ui_HTMLTable.prototype.setCellPadding = function(padding) {
    DOM_setIntAttribute(this.tableElem, 'cellPadding', padding);
    };
    __ui_HTMLTable.prototype.__class__.setCellPadding = function() {
        return __ui_HTMLTable.prototype.setCellPadding.call.apply(__ui_HTMLTable.prototype.setCellPadding, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setCellPadding.unbound_method = true;
    __ui_HTMLTable.prototype.setCellPadding.instance_method = true;
    __ui_HTMLTable.prototype.setCellSpacing = function(spacing) {
    DOM_setIntAttribute(this.tableElem, 'cellSpacing', spacing);
    };
    __ui_HTMLTable.prototype.__class__.setCellSpacing = function() {
        return __ui_HTMLTable.prototype.setCellSpacing.call.apply(__ui_HTMLTable.prototype.setCellSpacing, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setCellSpacing.unbound_method = true;
    __ui_HTMLTable.prototype.setCellSpacing.instance_method = true;
    __ui_HTMLTable.prototype.setHTML = function(row, column, html) {
    this.prepareCell(row, column);
    var td = this.cleanCell(row, column);
    if ((html != null)) {
    DOM_setInnerHTML(td, html);
    }
    };
    __ui_HTMLTable.prototype.__class__.setHTML = function() {
        return __ui_HTMLTable.prototype.setHTML.call.apply(__ui_HTMLTable.prototype.setHTML, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setHTML.unbound_method = true;
    __ui_HTMLTable.prototype.setHTML.instance_method = true;
    __ui_HTMLTable.prototype.setText = function(row, column, text) {
    this.prepareCell(row, column);
    var td = this.cleanCell(row, column);
    if ((text != null)) {
    DOM_setInnerText(td, text);
    }
    };
    __ui_HTMLTable.prototype.__class__.setText = function() {
        return __ui_HTMLTable.prototype.setText.call.apply(__ui_HTMLTable.prototype.setText, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setText.unbound_method = true;
    __ui_HTMLTable.prototype.setText.instance_method = true;
    __ui_HTMLTable.prototype.setWidget = function(row, column, widget) {
    this.prepareCell(row, column);
    if ((widget == null)) {
    return;
    }
    widget.removeFromParent();
    var td = this.cleanCell(row, column);
    var widget_hash = pyjslib_hash(widget);
    var element = widget.getElement();
    DOM_setAttribute(element, '__hash', widget_hash);
    this.widgetMap.__setitem__(widget_hash, widget);
    this.adopt(widget, td);
    };
    __ui_HTMLTable.prototype.__class__.setWidget = function() {
        return __ui_HTMLTable.prototype.setWidget.call.apply(__ui_HTMLTable.prototype.setWidget, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setWidget.unbound_method = true;
    __ui_HTMLTable.prototype.setWidget.instance_method = true;
    __ui_HTMLTable.prototype.cleanCell = function(row, column) {
    var td = this.cellFormatter.getRawElement(row, column);
    this.internalClearCell(td);
    return td;
    };
    __ui_HTMLTable.prototype.__class__.cleanCell = function() {
        return __ui_HTMLTable.prototype.cleanCell.call.apply(__ui_HTMLTable.prototype.cleanCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.cleanCell.unbound_method = true;
    __ui_HTMLTable.prototype.cleanCell.instance_method = true;
    __ui_HTMLTable.prototype.computeKey = function(row, column) {
    var element = this.cellFormatter.getRawElement(row, column);
    var child = DOM_getFirstChild(element);
    if ((child == null)) {
    return;
    }
    return this.computeKeyForElement(child);
    };
    __ui_HTMLTable.prototype.__class__.computeKey = function() {
        return __ui_HTMLTable.prototype.computeKey.call.apply(__ui_HTMLTable.prototype.computeKey, arguments);
    };
    __ui_HTMLTable.prototype.__class__.computeKey.unbound_method = true;
    __ui_HTMLTable.prototype.computeKey.instance_method = true;
    __ui_HTMLTable.prototype.computeKeyForElement = function(widgetElement) {
    return DOM_getAttribute(widgetElement, '__hash');
    };
    __ui_HTMLTable.prototype.__class__.computeKeyForElement = function() {
        return __ui_HTMLTable.prototype.computeKeyForElement.call.apply(__ui_HTMLTable.prototype.computeKeyForElement, arguments);
    };
    __ui_HTMLTable.prototype.__class__.computeKeyForElement.unbound_method = true;
    __ui_HTMLTable.prototype.computeKeyForElement.instance_method = true;
    __ui_HTMLTable.prototype.removeWidget = function(widget) {
    this.disown(widget);
    this.widgetMap.__delitem__(this.computeKeyForElement(widget.getElement()));
    return true;
    };
    __ui_HTMLTable.prototype.__class__.removeWidget = function() {
        return __ui_HTMLTable.prototype.removeWidget.call.apply(__ui_HTMLTable.prototype.removeWidget, arguments);
    };
    __ui_HTMLTable.prototype.__class__.removeWidget.unbound_method = true;
    __ui_HTMLTable.prototype.removeWidget.instance_method = true;
    __ui_HTMLTable.prototype.checkCellBounds = function(row, column) {
    this.checkRowBounds(row);
    var cellSize = this.getCellCount(row);
    };
    __ui_HTMLTable.prototype.__class__.checkCellBounds = function() {
        return __ui_HTMLTable.prototype.checkCellBounds.call.apply(__ui_HTMLTable.prototype.checkCellBounds, arguments);
    };
    __ui_HTMLTable.prototype.__class__.checkCellBounds.unbound_method = true;
    __ui_HTMLTable.prototype.checkCellBounds.instance_method = true;
    __ui_HTMLTable.prototype.checkRowBounds = function(row) {
    var rowSize = this.getRowCount();
    };
    __ui_HTMLTable.prototype.__class__.checkRowBounds = function() {
        return __ui_HTMLTable.prototype.checkRowBounds.call.apply(__ui_HTMLTable.prototype.checkRowBounds, arguments);
    };
    __ui_HTMLTable.prototype.__class__.checkRowBounds.unbound_method = true;
    __ui_HTMLTable.prototype.checkRowBounds.instance_method = true;
    __ui_HTMLTable.prototype.createCell = function() {
    return DOM_createTD();
    };
    __ui_HTMLTable.prototype.__class__.createCell = function() {
        return __ui_HTMLTable.prototype.createCell.call.apply(__ui_HTMLTable.prototype.createCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.createCell.unbound_method = true;
    __ui_HTMLTable.prototype.createCell.instance_method = true;
    __ui_HTMLTable.prototype.getBodyElement = function() {
    return this.bodyElem;
    };
    __ui_HTMLTable.prototype.__class__.getBodyElement = function() {
        return __ui_HTMLTable.prototype.getBodyElement.call.apply(__ui_HTMLTable.prototype.getBodyElement, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getBodyElement.unbound_method = true;
    __ui_HTMLTable.prototype.getBodyElement.instance_method = true;
    __ui_HTMLTable.prototype.getDOMCellCount = function(element, row) {
    if (typeof row == 'undefined') row=null;
    if ((row == null)) {
    return this.getDOMCellCountImpl(this.bodyElem, element);
    }
    return this.getDOMCellCountImpl(element, row);
    };
__ui_HTMLTable.prototype.getDOMCellCount.parse_kwargs = function ( __kwargs, element, row ) {
    if (typeof row == 'undefined')
        row=__kwargs.row;
    var __r = [element, row];
    return __r;
};
    __ui_HTMLTable.prototype.__class__.getDOMCellCount = function() {
        return __ui_HTMLTable.prototype.getDOMCellCount.call.apply(__ui_HTMLTable.prototype.getDOMCellCount, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getDOMCellCount.unbound_method = true;
    __ui_HTMLTable.prototype.getDOMCellCount.instance_method = true;
    __ui_HTMLTable.prototype.__class__.getDOMCellCount.parse_kwargs = __ui_HTMLTable.prototype.getDOMCellCount.parse_kwargs;
    __ui_HTMLTable.prototype.getDOMCellCountImpl = function(element, row) {

        return element.rows[row].cells.length;
        
    };
    __ui_HTMLTable.prototype.__class__.getDOMCellCountImpl = function() {
        return __ui_HTMLTable.prototype.getDOMCellCountImpl.call.apply(__ui_HTMLTable.prototype.getDOMCellCountImpl, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getDOMCellCountImpl.unbound_method = true;
    __ui_HTMLTable.prototype.getDOMCellCountImpl.instance_method = true;
    __ui_HTMLTable.prototype.getDOMRowCount = function(element) {
    if (typeof element == 'undefined') element=null;
    if ((element == null)) {
    var element = this.bodyElem;
    }
    return this.getDOMRowCountImpl(element);
    };
__ui_HTMLTable.prototype.getDOMRowCount.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
    __ui_HTMLTable.prototype.__class__.getDOMRowCount = function() {
        return __ui_HTMLTable.prototype.getDOMRowCount.call.apply(__ui_HTMLTable.prototype.getDOMRowCount, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getDOMRowCount.unbound_method = true;
    __ui_HTMLTable.prototype.getDOMRowCount.instance_method = true;
    __ui_HTMLTable.prototype.__class__.getDOMRowCount.parse_kwargs = __ui_HTMLTable.prototype.getDOMRowCount.parse_kwargs;
    __ui_HTMLTable.prototype.getDOMRowCountImpl = function(element) {

        return element.rows.length;
        
    };
    __ui_HTMLTable.prototype.__class__.getDOMRowCountImpl = function() {
        return __ui_HTMLTable.prototype.getDOMRowCountImpl.call.apply(__ui_HTMLTable.prototype.getDOMRowCountImpl, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getDOMRowCountImpl.unbound_method = true;
    __ui_HTMLTable.prototype.getDOMRowCountImpl.instance_method = true;
    __ui_HTMLTable.prototype.getEventTargetCell = function(event) {
    var td = DOM_eventGetTarget(event);
    while ((td != null)) {
    if ((DOM_getAttribute(td, 'tagName').lower() == 'td')) {
    var tr = DOM_getParent(td);
    var body = DOM_getParent(tr);
    if (DOM_compare(body, this.bodyElem)) {
    return td;
    }
    }
    if (DOM_compare(td, this.bodyElem)) {
    return;
    }
    var td = DOM_getParent(td);
    }
    return;
    };
    __ui_HTMLTable.prototype.__class__.getEventTargetCell = function() {
        return __ui_HTMLTable.prototype.getEventTargetCell.call.apply(__ui_HTMLTable.prototype.getEventTargetCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getEventTargetCell.unbound_method = true;
    __ui_HTMLTable.prototype.getEventTargetCell.instance_method = true;
    __ui_HTMLTable.prototype.insertCell = function(row, column) {
    var tr = this.rowFormatter.getRow(this.bodyElem, row);
    var td = this.createCell();
    DOM_insertChild(tr, td, column);
    };
    __ui_HTMLTable.prototype.__class__.insertCell = function() {
        return __ui_HTMLTable.prototype.insertCell.call.apply(__ui_HTMLTable.prototype.insertCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.insertCell.unbound_method = true;
    __ui_HTMLTable.prototype.insertCell.instance_method = true;
    __ui_HTMLTable.prototype.insertCells = function(row, column, count) {
    var tr = this.rowFormatter.getRow(this.bodyElem, row);

        var __i = pyjslib_range(column,  ( column + count ) ).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var td = this.createCell();
    DOM_insertChild(tr, td, i);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_HTMLTable.prototype.__class__.insertCells = function() {
        return __ui_HTMLTable.prototype.insertCells.call.apply(__ui_HTMLTable.prototype.insertCells, arguments);
    };
    __ui_HTMLTable.prototype.__class__.insertCells.unbound_method = true;
    __ui_HTMLTable.prototype.insertCells.instance_method = true;
    __ui_HTMLTable.prototype.insertRow = function(beforeRow) {
    if ((beforeRow != this.getRowCount())) {
    this.checkRowBounds(beforeRow);
    }
    var tr = DOM_createTR();
    DOM_insertChild(this.bodyElem, tr, beforeRow);
    return beforeRow;
    };
    __ui_HTMLTable.prototype.__class__.insertRow = function() {
        return __ui_HTMLTable.prototype.insertRow.call.apply(__ui_HTMLTable.prototype.insertRow, arguments);
    };
    __ui_HTMLTable.prototype.__class__.insertRow.unbound_method = true;
    __ui_HTMLTable.prototype.insertRow.instance_method = true;
    __ui_HTMLTable.prototype.internalClearCell = function(td) {
    var maybeChild = DOM_getFirstChild(td);
    var widget = null;
    if ((maybeChild != null)) {
    var widget = this.getWidget(maybeChild);
    }
    if ((widget != null)) {
    this.removeWidget(widget);
    return true;
    }
    DOM_setInnerHTML(td, '');
    return false;
    };
    __ui_HTMLTable.prototype.__class__.internalClearCell = function() {
        return __ui_HTMLTable.prototype.internalClearCell.call.apply(__ui_HTMLTable.prototype.internalClearCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.internalClearCell.unbound_method = true;
    __ui_HTMLTable.prototype.internalClearCell.instance_method = true;
    __ui_HTMLTable.prototype.prepareCell = function(row, column) {
    };
    __ui_HTMLTable.prototype.__class__.prepareCell = function() {
        return __ui_HTMLTable.prototype.prepareCell.call.apply(__ui_HTMLTable.prototype.prepareCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.prepareCell.unbound_method = true;
    __ui_HTMLTable.prototype.prepareCell.instance_method = true;
    __ui_HTMLTable.prototype.prepareRow = function(row) {
    };
    __ui_HTMLTable.prototype.__class__.prepareRow = function() {
        return __ui_HTMLTable.prototype.prepareRow.call.apply(__ui_HTMLTable.prototype.prepareRow, arguments);
    };
    __ui_HTMLTable.prototype.__class__.prepareRow.unbound_method = true;
    __ui_HTMLTable.prototype.prepareRow.instance_method = true;
    __ui_HTMLTable.prototype.removeCell = function(row, column) {
    this.checkCellBounds(row, column);
    var td = this.cleanCell(row, column);
    var tr = this.rowFormatter.getRow(this.bodyElem, row);
    DOM_removeChild(tr, td);
    };
    __ui_HTMLTable.prototype.__class__.removeCell = function() {
        return __ui_HTMLTable.prototype.removeCell.call.apply(__ui_HTMLTable.prototype.removeCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.removeCell.unbound_method = true;
    __ui_HTMLTable.prototype.removeCell.instance_method = true;
    __ui_HTMLTable.prototype.removeRow = function(row) {

        var __column = pyjslib_range(this.getCellCount(row)).__iter__();
        try {
            while (true) {
                var column = __column.next();
                
        
    this.cleanCell(row, column);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    DOM_removeChild(this.bodyElem, this.rowFormatter.getRow(this.bodyElem, row));
    };
    __ui_HTMLTable.prototype.__class__.removeRow = function() {
        return __ui_HTMLTable.prototype.removeRow.call.apply(__ui_HTMLTable.prototype.removeRow, arguments);
    };
    __ui_HTMLTable.prototype.__class__.removeRow.unbound_method = true;
    __ui_HTMLTable.prototype.removeRow.instance_method = true;
    __ui_HTMLTable.prototype.setCellFormatter = function(cellFormatter) {
    this.cellFormatter = cellFormatter;
    };
    __ui_HTMLTable.prototype.__class__.setCellFormatter = function() {
        return __ui_HTMLTable.prototype.setCellFormatter.call.apply(__ui_HTMLTable.prototype.setCellFormatter, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setCellFormatter.unbound_method = true;
    __ui_HTMLTable.prototype.setCellFormatter.instance_method = true;
    __ui_HTMLTable.prototype.setRowFormatter = function(rowFormatter) {
    this.rowFormatter = rowFormatter;
    };
    __ui_HTMLTable.prototype.__class__.setRowFormatter = function() {
        return __ui_HTMLTable.prototype.setRowFormatter.call.apply(__ui_HTMLTable.prototype.setRowFormatter, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setRowFormatter.unbound_method = true;
    __ui_HTMLTable.prototype.setRowFormatter.instance_method = true;
}
function __ui_Grid() {
}
function ui_Grid(rows, columns) {
    if (typeof rows == 'undefined') rows=0;
    if (typeof columns == 'undefined') columns=0;
    var instance = new __ui_Grid();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Grid.parse_kwargs = function ( __kwargs, rows, columns ) {
    if (typeof rows == 'undefined')
        rows=__kwargs.rows;
    if (typeof columns == 'undefined')
        columns=__kwargs.columns;
    var __r = [rows, columns];
    return __r;
};
function __ui_Grid_initialize() {
    if(__ui_Grid.__was_initialized__) return;
    __ui_Grid.__was_initialized__ = true;
    if(!__ui_HTMLTable.__was_initialized__)
        __ui_HTMLTable_initialize();
    pyjs_extend(__ui_Grid, __ui_HTMLTable);
    __ui_Grid.prototype.__class__.__new__ = ui_Grid;
    __ui_Grid.prototype.__init__ = function(rows, columns) {
    if (typeof rows == 'undefined') rows=0;
    if (typeof columns == 'undefined') columns=0;
    __ui_HTMLTable.prototype.__class__.__init__(this);
    this.cellFormatter = ui_CellFormatter(this);
    this.rowFormatter = ui_RowFormatter(this);
    this.numColumns = 0;
    this.numRows = 0;
    if (((rows > 0)) || ((columns > 0))) {
    this.resize(rows, columns);
    }
    };
__ui_Grid.prototype.__init__.parse_kwargs = function ( __kwargs, rows, columns ) {
    if (typeof rows == 'undefined')
        rows=__kwargs.rows;
    if (typeof columns == 'undefined')
        columns=__kwargs.columns;
    var __r = [rows, columns];
    return __r;
};
    __ui_Grid.prototype.__class__.__init__ = function() {
        return __ui_Grid.prototype.__init__.call.apply(__ui_Grid.prototype.__init__, arguments);
    };
    __ui_Grid.prototype.__class__.__init__.unbound_method = true;
    __ui_Grid.prototype.__init__.instance_method = true;
    __ui_Grid.prototype.__class__.__init__.parse_kwargs = __ui_Grid.prototype.__init__.parse_kwargs;
    __ui_Grid.prototype.resize = function(rows, columns) {
    this.resizeColumns(columns);
    this.resizeRows(rows);
    };
    __ui_Grid.prototype.__class__.resize = function() {
        return __ui_Grid.prototype.resize.call.apply(__ui_Grid.prototype.resize, arguments);
    };
    __ui_Grid.prototype.__class__.resize.unbound_method = true;
    __ui_Grid.prototype.resize.instance_method = true;
    __ui_Grid.prototype.resizeColumns = function(columns) {
    if ((this.numColumns == columns)) {
    return;
    }
    if ((this.numColumns > columns)) {

        var __i = pyjslib_range(0, this.numRows).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        

        var __j = pyjslib_range( ( this.numColumns - 1 ) ,  ( columns - 1 ) , -1).__iter__();
        try {
            while (true) {
                var j = __j.next();
                
        
    this.removeCell(i, j);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else {

        var __i = pyjslib_range(this.numRows).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        

        var __j = pyjslib_range(this.numColumns, columns).__iter__();
        try {
            while (true) {
                var j = __j.next();
                
        
    this.insertCell(i, j);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    this.numColumns = columns;
    };
    __ui_Grid.prototype.__class__.resizeColumns = function() {
        return __ui_Grid.prototype.resizeColumns.call.apply(__ui_Grid.prototype.resizeColumns, arguments);
    };
    __ui_Grid.prototype.__class__.resizeColumns.unbound_method = true;
    __ui_Grid.prototype.resizeColumns.instance_method = true;
    __ui_Grid.prototype.resizeRows = function(rows) {
    if ((this.numRows == rows)) {
    return;
    }
    if ((this.numRows < rows)) {
    this.addRows(this.getBodyElement(),  ( rows - this.numRows ) , this.numColumns);
    this.numRows = rows;
    }
    else {
    while ((this.numRows > rows)) {
    this.numRows -= 1;
    this.removeRow(this.numRows);
    }
    }
    };
    __ui_Grid.prototype.__class__.resizeRows = function() {
        return __ui_Grid.prototype.resizeRows.call.apply(__ui_Grid.prototype.resizeRows, arguments);
    };
    __ui_Grid.prototype.__class__.resizeRows.unbound_method = true;
    __ui_Grid.prototype.resizeRows.instance_method = true;
    __ui_Grid.prototype.createCell = function() {
    var td = __ui_HTMLTable.prototype.__class__.createCell(this);
    DOM_setInnerHTML(td, '&nbsp;');
    return td;
    };
    __ui_Grid.prototype.__class__.createCell = function() {
        return __ui_Grid.prototype.createCell.call.apply(__ui_Grid.prototype.createCell, arguments);
    };
    __ui_Grid.prototype.__class__.createCell.unbound_method = true;
    __ui_Grid.prototype.createCell.instance_method = true;
    __ui_Grid.prototype.clearCell = function(row, column) {
    var td = this.cellFormatter.getElement(row, column);
    var b = __ui_HTMLTable.prototype.__class__.internalClearCell(this, td);
    DOM_setInnerHTML(td, '&nbsp;');
    return b;
    };
    __ui_Grid.prototype.__class__.clearCell = function() {
        return __ui_Grid.prototype.clearCell.call.apply(__ui_Grid.prototype.clearCell, arguments);
    };
    __ui_Grid.prototype.__class__.clearCell.unbound_method = true;
    __ui_Grid.prototype.clearCell.instance_method = true;
    __ui_Grid.prototype.prepareCell = function(row, column) {
    };
    __ui_Grid.prototype.__class__.prepareCell = function() {
        return __ui_Grid.prototype.prepareCell.call.apply(__ui_Grid.prototype.prepareCell, arguments);
    };
    __ui_Grid.prototype.__class__.prepareCell.unbound_method = true;
    __ui_Grid.prototype.prepareCell.instance_method = true;
    __ui_Grid.prototype.prepareRow = function(row) {
    };
    __ui_Grid.prototype.__class__.prepareRow = function() {
        return __ui_Grid.prototype.prepareRow.call.apply(__ui_Grid.prototype.prepareRow, arguments);
    };
    __ui_Grid.prototype.__class__.prepareRow.unbound_method = true;
    __ui_Grid.prototype.prepareRow.instance_method = true;
    __ui_Grid.prototype.getCellCount = function(row) {
    return this.numColumns;
    };
    __ui_Grid.prototype.__class__.getCellCount = function() {
        return __ui_Grid.prototype.getCellCount.call.apply(__ui_Grid.prototype.getCellCount, arguments);
    };
    __ui_Grid.prototype.__class__.getCellCount.unbound_method = true;
    __ui_Grid.prototype.getCellCount.instance_method = true;
    __ui_Grid.prototype.getColumnCount = function() {
    return this.numColumns;
    };
    __ui_Grid.prototype.__class__.getColumnCount = function() {
        return __ui_Grid.prototype.getColumnCount.call.apply(__ui_Grid.prototype.getColumnCount, arguments);
    };
    __ui_Grid.prototype.__class__.getColumnCount.unbound_method = true;
    __ui_Grid.prototype.getColumnCount.instance_method = true;
    __ui_Grid.prototype.getRowCount = function() {
    return this.numRows;
    };
    __ui_Grid.prototype.__class__.getRowCount = function() {
        return __ui_Grid.prototype.getRowCount.call.apply(__ui_Grid.prototype.getRowCount, arguments);
    };
    __ui_Grid.prototype.__class__.getRowCount.unbound_method = true;
    __ui_Grid.prototype.getRowCount.instance_method = true;
    __ui_Grid.prototype.addRows = function(table, numRows, columns) {

        var td = $doc.createElement("td");
        td.innerHTML = "&nbsp;";
        var row = $doc.createElement("tr");
        for(var cellNum = 0; cellNum < columns; cellNum++) {
            var cell = td.cloneNode(true);
            row.appendChild(cell);
        }
        table.appendChild(row);
        for(var rowNum = 1; rowNum < numRows; rowNum++) {
            table.appendChild(row.cloneNode(true));
        }
        
    };
    __ui_Grid.prototype.__class__.addRows = function() {
        return __ui_Grid.prototype.addRows.call.apply(__ui_Grid.prototype.addRows, arguments);
    };
    __ui_Grid.prototype.__class__.addRows.unbound_method = true;
    __ui_Grid.prototype.addRows.instance_method = true;
}
function __ui_FlexCellFormatter() {
}
function ui_FlexCellFormatter(outer) {
    var instance = new __ui_FlexCellFormatter();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FlexCellFormatter_initialize() {
    if(__ui_FlexCellFormatter.__was_initialized__) return;
    __ui_FlexCellFormatter.__was_initialized__ = true;
    if(!__ui_CellFormatter.__was_initialized__)
        __ui_CellFormatter_initialize();
    pyjs_extend(__ui_FlexCellFormatter, __ui_CellFormatter);
    __ui_FlexCellFormatter.prototype.__class__.__new__ = ui_FlexCellFormatter;
    __ui_FlexCellFormatter.prototype.__init__ = function(outer) {
    __ui_CellFormatter.prototype.__class__.__init__(this, outer);
    };
    __ui_FlexCellFormatter.prototype.__class__.__init__ = function() {
        return __ui_FlexCellFormatter.prototype.__init__.call.apply(__ui_FlexCellFormatter.prototype.__init__, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.__init__.unbound_method = true;
    __ui_FlexCellFormatter.prototype.__init__.instance_method = true;
    __ui_FlexCellFormatter.prototype.getColSpan = function(row, column) {
    return DOM_getIntAttribute(this.getElement(row, column), 'colSpan');
    };
    __ui_FlexCellFormatter.prototype.__class__.getColSpan = function() {
        return __ui_FlexCellFormatter.prototype.getColSpan.call.apply(__ui_FlexCellFormatter.prototype.getColSpan, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.getColSpan.unbound_method = true;
    __ui_FlexCellFormatter.prototype.getColSpan.instance_method = true;
    __ui_FlexCellFormatter.prototype.getRowSpan = function(row, column) {
    return DOM_getIntAttribute(this.getElement(row, column), 'rowSpan');
    };
    __ui_FlexCellFormatter.prototype.__class__.getRowSpan = function() {
        return __ui_FlexCellFormatter.prototype.getRowSpan.call.apply(__ui_FlexCellFormatter.prototype.getRowSpan, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.getRowSpan.unbound_method = true;
    __ui_FlexCellFormatter.prototype.getRowSpan.instance_method = true;
    __ui_FlexCellFormatter.prototype.setColSpan = function(row, column, colSpan) {
    DOM_setIntAttribute(this.ensureElement(row, column), 'colSpan', colSpan);
    };
    __ui_FlexCellFormatter.prototype.__class__.setColSpan = function() {
        return __ui_FlexCellFormatter.prototype.setColSpan.call.apply(__ui_FlexCellFormatter.prototype.setColSpan, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.setColSpan.unbound_method = true;
    __ui_FlexCellFormatter.prototype.setColSpan.instance_method = true;
    __ui_FlexCellFormatter.prototype.setRowSpan = function(row, column, rowSpan) {
    DOM_setIntAttribute(this.ensureElement(row, column), 'rowSpan', rowSpan);
    };
    __ui_FlexCellFormatter.prototype.__class__.setRowSpan = function() {
        return __ui_FlexCellFormatter.prototype.setRowSpan.call.apply(__ui_FlexCellFormatter.prototype.setRowSpan, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.setRowSpan.unbound_method = true;
    __ui_FlexCellFormatter.prototype.setRowSpan.instance_method = true;
}
function __ui_FlexTable() {
}
function ui_FlexTable() {
    var instance = new __ui_FlexTable();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FlexTable_initialize() {
    if(__ui_FlexTable.__was_initialized__) return;
    __ui_FlexTable.__was_initialized__ = true;
    if(!__ui_HTMLTable.__was_initialized__)
        __ui_HTMLTable_initialize();
    pyjs_extend(__ui_FlexTable, __ui_HTMLTable);
    __ui_FlexTable.prototype.__class__.__new__ = ui_FlexTable;
    __ui_FlexTable.prototype.__init__ = function() {
    __ui_HTMLTable.prototype.__class__.__init__(this);
    this.cellFormatter = ui_FlexCellFormatter(this);
    this.rowFormatter = ui_RowFormatter(this);
    };
    __ui_FlexTable.prototype.__class__.__init__ = function() {
        return __ui_FlexTable.prototype.__init__.call.apply(__ui_FlexTable.prototype.__init__, arguments);
    };
    __ui_FlexTable.prototype.__class__.__init__.unbound_method = true;
    __ui_FlexTable.prototype.__init__.instance_method = true;
    __ui_FlexTable.prototype.addCell = function(row) {
    this.insertCell(row, this.getCellCount(row));
    };
    __ui_FlexTable.prototype.__class__.addCell = function() {
        return __ui_FlexTable.prototype.addCell.call.apply(__ui_FlexTable.prototype.addCell, arguments);
    };
    __ui_FlexTable.prototype.__class__.addCell.unbound_method = true;
    __ui_FlexTable.prototype.addCell.instance_method = true;
    __ui_FlexTable.prototype.getCellCount = function(row) {
    this.checkRowBounds(row);
    return this.getDOMCellCount(this.getBodyElement(), row);
    };
    __ui_FlexTable.prototype.__class__.getCellCount = function() {
        return __ui_FlexTable.prototype.getCellCount.call.apply(__ui_FlexTable.prototype.getCellCount, arguments);
    };
    __ui_FlexTable.prototype.__class__.getCellCount.unbound_method = true;
    __ui_FlexTable.prototype.getCellCount.instance_method = true;
    __ui_FlexTable.prototype.getFlexCellFormatter = function() {
    return this.getCellFormatter();
    };
    __ui_FlexTable.prototype.__class__.getFlexCellFormatter = function() {
        return __ui_FlexTable.prototype.getFlexCellFormatter.call.apply(__ui_FlexTable.prototype.getFlexCellFormatter, arguments);
    };
    __ui_FlexTable.prototype.__class__.getFlexCellFormatter.unbound_method = true;
    __ui_FlexTable.prototype.getFlexCellFormatter.instance_method = true;
    __ui_FlexTable.prototype.getRowCount = function() {
    return this.getDOMRowCount();
    };
    __ui_FlexTable.prototype.__class__.getRowCount = function() {
        return __ui_FlexTable.prototype.getRowCount.call.apply(__ui_FlexTable.prototype.getRowCount, arguments);
    };
    __ui_FlexTable.prototype.__class__.getRowCount.unbound_method = true;
    __ui_FlexTable.prototype.getRowCount.instance_method = true;
    __ui_FlexTable.prototype.removeCells = function(row, column, num) {

        var __i = pyjslib_range(num).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.removeCell(row, column);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_FlexTable.prototype.__class__.removeCells = function() {
        return __ui_FlexTable.prototype.removeCells.call.apply(__ui_FlexTable.prototype.removeCells, arguments);
    };
    __ui_FlexTable.prototype.__class__.removeCells.unbound_method = true;
    __ui_FlexTable.prototype.removeCells.instance_method = true;
    __ui_FlexTable.prototype.prepareCell = function(row, column) {
    this.prepareRow(row);
    var cellCount = this.getCellCount(row);
    var required =  (  ( column + 1 )  - cellCount ) ;
    if ((required > 0)) {
    this.addCells(this.getBodyElement(), row, required);
    }
    };
    __ui_FlexTable.prototype.__class__.prepareCell = function() {
        return __ui_FlexTable.prototype.prepareCell.call.apply(__ui_FlexTable.prototype.prepareCell, arguments);
    };
    __ui_FlexTable.prototype.__class__.prepareCell.unbound_method = true;
    __ui_FlexTable.prototype.prepareCell.instance_method = true;
    __ui_FlexTable.prototype.prepareRow = function(row) {
    var rowCount = this.getRowCount();

        var __i = pyjslib_range(rowCount,  ( row + 1 ) ).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.insertRow(i);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_FlexTable.prototype.__class__.prepareRow = function() {
        return __ui_FlexTable.prototype.prepareRow.call.apply(__ui_FlexTable.prototype.prepareRow, arguments);
    };
    __ui_FlexTable.prototype.__class__.prepareRow.unbound_method = true;
    __ui_FlexTable.prototype.prepareRow.instance_method = true;
    __ui_FlexTable.prototype.addCells = function(table, row, num) {

        var rowElem = table.rows[row];
        for(var i = 0; i < num; i++){
            var cell = $doc.createElement("td");
            rowElem.appendChild(cell);
        }
        
    };
    __ui_FlexTable.prototype.__class__.addCells = function() {
        return __ui_FlexTable.prototype.addCells.call.apply(__ui_FlexTable.prototype.addCells, arguments);
    };
    __ui_FlexTable.prototype.__class__.addCells.unbound_method = true;
    __ui_FlexTable.prototype.addCells.instance_method = true;
}
function __ui_ComplexPanel() {
}
function ui_ComplexPanel() {
    var instance = new __ui_ComplexPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ComplexPanel_initialize() {
    if(__ui_ComplexPanel.__was_initialized__) return;
    __ui_ComplexPanel.__was_initialized__ = true;
    if(!__ui_Panel.__was_initialized__)
        __ui_Panel_initialize();
    pyjs_extend(__ui_ComplexPanel, __ui_Panel);
    __ui_ComplexPanel.prototype.__class__.__new__ = ui_ComplexPanel;
    __ui_ComplexPanel.prototype.__init__ = function() {
    __ui_Panel.prototype.__class__.__init__(this);
    this.children = new pyjslib_List([]);
    };
    __ui_ComplexPanel.prototype.__class__.__init__ = function() {
        return __ui_ComplexPanel.prototype.__init__.call.apply(__ui_ComplexPanel.prototype.__init__, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_ComplexPanel.prototype.__init__.instance_method = true;
    __ui_ComplexPanel.prototype.add = function(widget, container) {
    this.insert(widget, container, pyjslib_len(this.children));
    };
    __ui_ComplexPanel.prototype.__class__.add = function() {
        return __ui_ComplexPanel.prototype.add.call.apply(__ui_ComplexPanel.prototype.add, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.add.unbound_method = true;
    __ui_ComplexPanel.prototype.add.instance_method = true;
    __ui_ComplexPanel.prototype.getChildren = function() {
    return this.children;
    };
    __ui_ComplexPanel.prototype.__class__.getChildren = function() {
        return __ui_ComplexPanel.prototype.getChildren.call.apply(__ui_ComplexPanel.prototype.getChildren, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.getChildren.unbound_method = true;
    __ui_ComplexPanel.prototype.getChildren.instance_method = true;
    __ui_ComplexPanel.prototype.insert = function(widget, container, beforeIndex) {
    if ((widget.getParent() == this)) {
    return;
    }
    this.adopt(widget, container);
    this.children.insert(beforeIndex, widget);
    };
    __ui_ComplexPanel.prototype.__class__.insert = function() {
        return __ui_ComplexPanel.prototype.insert.call.apply(__ui_ComplexPanel.prototype.insert, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.insert.unbound_method = true;
    __ui_ComplexPanel.prototype.insert.instance_method = true;
    __ui_ComplexPanel.prototype.remove = function(widget) {
    if (!this.children.__contains__(widget)) {
    return false;
    }
    this.disown(widget);
    this.children.remove(widget);
    return true;
    };
    __ui_ComplexPanel.prototype.__class__.remove = function() {
        return __ui_ComplexPanel.prototype.remove.call.apply(__ui_ComplexPanel.prototype.remove, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.remove.unbound_method = true;
    __ui_ComplexPanel.prototype.remove.instance_method = true;
}
function __ui_AbsolutePanel() {
}
function ui_AbsolutePanel() {
    var instance = new __ui_AbsolutePanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_AbsolutePanel_initialize() {
    if(__ui_AbsolutePanel.__was_initialized__) return;
    __ui_AbsolutePanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_AbsolutePanel, __ui_ComplexPanel);
    __ui_AbsolutePanel.prototype.__class__.__new__ = ui_AbsolutePanel;
    __ui_AbsolutePanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.setElement(DOM_createDiv());
    DOM_setStyleAttribute(this.getElement(), 'position', 'relative');
    DOM_setStyleAttribute(this.getElement(), 'overflow', 'hidden');
    };
    __ui_AbsolutePanel.prototype.__class__.__init__ = function() {
        return __ui_AbsolutePanel.prototype.__init__.call.apply(__ui_AbsolutePanel.prototype.__init__, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.__init__.unbound_method = true;
    __ui_AbsolutePanel.prototype.__init__.instance_method = true;
    __ui_AbsolutePanel.prototype.add = function(widget, left, top) {
    if (typeof left == 'undefined') left=null;
    if (typeof top == 'undefined') top=null;
    __ui_ComplexPanel.prototype.__class__.add(this, widget, this.getElement());
    if ((left != null)) {
    this.setWidgetPosition(widget, left, top);
    }
    };
__ui_AbsolutePanel.prototype.add.parse_kwargs = function ( __kwargs, widget, left, top ) {
    if (typeof left == 'undefined')
        left=__kwargs.left;
    if (typeof top == 'undefined')
        top=__kwargs.top;
    var __r = [widget, left, top];
    return __r;
};
    __ui_AbsolutePanel.prototype.__class__.add = function() {
        return __ui_AbsolutePanel.prototype.add.call.apply(__ui_AbsolutePanel.prototype.add, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.add.unbound_method = true;
    __ui_AbsolutePanel.prototype.add.instance_method = true;
    __ui_AbsolutePanel.prototype.__class__.add.parse_kwargs = __ui_AbsolutePanel.prototype.add.parse_kwargs;
    __ui_AbsolutePanel.prototype.setWidgetPosition = function(widget, left, top) {
    this.checkWidgetParent(widget);
    var h = widget.getElement();
    if (((left == -1)) && ((top == -1))) {
    DOM_setStyleAttribute(h, 'left', '');
    DOM_setStyleAttribute(h, 'top', '');
    DOM_setStyleAttribute(h, 'position', 'static');
    }
    else {
    DOM_setStyleAttribute(h, 'position', 'absolute');
    DOM_setStyleAttribute(h, 'left',  ( left + 'px' ) );
    DOM_setStyleAttribute(h, 'top',  ( top + 'px' ) );
    }
    };
    __ui_AbsolutePanel.prototype.__class__.setWidgetPosition = function() {
        return __ui_AbsolutePanel.prototype.setWidgetPosition.call.apply(__ui_AbsolutePanel.prototype.setWidgetPosition, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.setWidgetPosition.unbound_method = true;
    __ui_AbsolutePanel.prototype.setWidgetPosition.instance_method = true;
    __ui_AbsolutePanel.prototype.getWidgetLeft = function(widget) {
    this.checkWidgetParent(widget);
    return DOM_getIntAttribute(widget.getElement(), 'offsetLeft');
    };
    __ui_AbsolutePanel.prototype.__class__.getWidgetLeft = function() {
        return __ui_AbsolutePanel.prototype.getWidgetLeft.call.apply(__ui_AbsolutePanel.prototype.getWidgetLeft, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.getWidgetLeft.unbound_method = true;
    __ui_AbsolutePanel.prototype.getWidgetLeft.instance_method = true;
    __ui_AbsolutePanel.prototype.getWidgetTop = function(widget) {
    this.checkWidgetParent(widget);
    return DOM_getIntAttribute(widget.getElement(), 'offsetTop');
    };
    __ui_AbsolutePanel.prototype.__class__.getWidgetTop = function() {
        return __ui_AbsolutePanel.prototype.getWidgetTop.call.apply(__ui_AbsolutePanel.prototype.getWidgetTop, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.getWidgetTop.unbound_method = true;
    __ui_AbsolutePanel.prototype.getWidgetTop.instance_method = true;
    __ui_AbsolutePanel.prototype.checkWidgetParent = function(widget) {
    if ((widget.getParent() != this)) {
    console.error('Widget must be a child of this panel.');
    }
    };
    __ui_AbsolutePanel.prototype.__class__.checkWidgetParent = function() {
        return __ui_AbsolutePanel.prototype.checkWidgetParent.call.apply(__ui_AbsolutePanel.prototype.checkWidgetParent, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.checkWidgetParent.unbound_method = true;
    __ui_AbsolutePanel.prototype.checkWidgetParent.instance_method = true;
}
function __ui_Label() {
}
function ui_Label(text, wordWrap) {
    if (typeof text == 'undefined') text=null;
    if (typeof wordWrap == 'undefined') wordWrap=true;
    var instance = new __ui_Label();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Label.parse_kwargs = function ( __kwargs, text, wordWrap ) {
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof wordWrap == 'undefined')
        wordWrap=__kwargs.wordWrap;
    var __r = [text, wordWrap];
    return __r;
};
function __ui_Label_initialize() {
    if(__ui_Label.__was_initialized__) return;
    __ui_Label.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Label, __ui_Widget);
    __ui_Label.prototype.__class__.__new__ = ui_Label;
    __ui_Label.prototype.__init__ = function(text, wordWrap) {
    if (typeof text == 'undefined') text=null;
    if (typeof wordWrap == 'undefined') wordWrap=true;
    __ui_Widget.prototype.__class__.__init__(this);
    this.horzAlign = '';
    this.clickListeners = new pyjslib_List([]);
    this.mouseListeners = new pyjslib_List([]);
    this.setElement(DOM_createDiv());
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.MOUSEEVENTS));
    this.setStyleName('gwt-Label');
    if (text) {
    this.setText(text);
    }
    this.setWordWrap(wordWrap);
    };
__ui_Label.prototype.__init__.parse_kwargs = function ( __kwargs, text, wordWrap ) {
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof wordWrap == 'undefined')
        wordWrap=__kwargs.wordWrap;
    var __r = [text, wordWrap];
    return __r;
};
    __ui_Label.prototype.__class__.__init__ = function() {
        return __ui_Label.prototype.__init__.call.apply(__ui_Label.prototype.__init__, arguments);
    };
    __ui_Label.prototype.__class__.__init__.unbound_method = true;
    __ui_Label.prototype.__init__.instance_method = true;
    __ui_Label.prototype.__class__.__init__.parse_kwargs = __ui_Label.prototype.__init__.parse_kwargs;
    __ui_Label.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_Label.prototype.__class__.addClickListener = function() {
        return __ui_Label.prototype.addClickListener.call.apply(__ui_Label.prototype.addClickListener, arguments);
    };
    __ui_Label.prototype.__class__.addClickListener.unbound_method = true;
    __ui_Label.prototype.addClickListener.instance_method = true;
    __ui_Label.prototype.addMouseListener = function(listener) {
    this.mouseListeners.append(listener);
    };
    __ui_Label.prototype.__class__.addMouseListener = function() {
        return __ui_Label.prototype.addMouseListener.call.apply(__ui_Label.prototype.addMouseListener, arguments);
    };
    __ui_Label.prototype.__class__.addMouseListener.unbound_method = true;
    __ui_Label.prototype.addMouseListener.instance_method = true;
    __ui_Label.prototype.getHorizontalAlignment = function() {
    return this.horzAlign;
    };
    __ui_Label.prototype.__class__.getHorizontalAlignment = function() {
        return __ui_Label.prototype.getHorizontalAlignment.call.apply(__ui_Label.prototype.getHorizontalAlignment, arguments);
    };
    __ui_Label.prototype.__class__.getHorizontalAlignment.unbound_method = true;
    __ui_Label.prototype.getHorizontalAlignment.instance_method = true;
    __ui_Label.prototype.getText = function() {
    return DOM_getInnerText(this.getElement());
    };
    __ui_Label.prototype.__class__.getText = function() {
        return __ui_Label.prototype.getText.call.apply(__ui_Label.prototype.getText, arguments);
    };
    __ui_Label.prototype.__class__.getText.unbound_method = true;
    __ui_Label.prototype.getText.instance_method = true;
    __ui_Label.prototype.getWordWrap = function() {
    return !((DOM_getStyleAttribute(this.getElement(), 'whiteSpace') == 'nowrap'));
    };
    __ui_Label.prototype.__class__.getWordWrap = function() {
        return __ui_Label.prototype.getWordWrap.call.apply(__ui_Label.prototype.getWordWrap, arguments);
    };
    __ui_Label.prototype.__class__.getWordWrap.unbound_method = true;
    __ui_Label.prototype.getWordWrap.instance_method = true;
    __ui_Label.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onClick) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if (((type == 'mousedown')) || ((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'mouseover')) || ((type == 'mouseout'))) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    }
    };
    __ui_Label.prototype.__class__.onBrowserEvent = function() {
        return __ui_Label.prototype.onBrowserEvent.call.apply(__ui_Label.prototype.onBrowserEvent, arguments);
    };
    __ui_Label.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Label.prototype.onBrowserEvent.instance_method = true;
    __ui_Label.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_Label.prototype.__class__.removeClickListener = function() {
        return __ui_Label.prototype.removeClickListener.call.apply(__ui_Label.prototype.removeClickListener, arguments);
    };
    __ui_Label.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_Label.prototype.removeClickListener.instance_method = true;
    __ui_Label.prototype.removeMouseListener = function(listener) {
    this.mouseListeners.remove(listener);
    };
    __ui_Label.prototype.__class__.removeMouseListener = function() {
        return __ui_Label.prototype.removeMouseListener.call.apply(__ui_Label.prototype.removeMouseListener, arguments);
    };
    __ui_Label.prototype.__class__.removeMouseListener.unbound_method = true;
    __ui_Label.prototype.removeMouseListener.instance_method = true;
    __ui_Label.prototype.setHorizontalAlignment = function(align) {
    this.horzAlign = align;
    DOM_setStyleAttribute(this.getElement(), 'textAlign', align);
    };
    __ui_Label.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_Label.prototype.setHorizontalAlignment.call.apply(__ui_Label.prototype.setHorizontalAlignment, arguments);
    };
    __ui_Label.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_Label.prototype.setHorizontalAlignment.instance_method = true;
    __ui_Label.prototype.setText = function(text) {
    DOM_setInnerText(this.getElement(), text);
    };
    __ui_Label.prototype.__class__.setText = function() {
        return __ui_Label.prototype.setText.call.apply(__ui_Label.prototype.setText, arguments);
    };
    __ui_Label.prototype.__class__.setText.unbound_method = true;
    __ui_Label.prototype.setText.instance_method = true;
    __ui_Label.prototype.setWordWrap = function(wrap) {
    if (wrap) {
    var style = 'normal';
    }
    else {
    var style = 'nowrap';
    }
    DOM_setStyleAttribute(this.getElement(), 'whiteSpace', style);
    };
    __ui_Label.prototype.__class__.setWordWrap = function() {
        return __ui_Label.prototype.setWordWrap.call.apply(__ui_Label.prototype.setWordWrap, arguments);
    };
    __ui_Label.prototype.__class__.setWordWrap.unbound_method = true;
    __ui_Label.prototype.setWordWrap.instance_method = true;
}
function __ui_HTML() {
}
function ui_HTML(html, wordWrap) {
    if (typeof html == 'undefined') html=null;
    if (typeof wordWrap == 'undefined') wordWrap=true;
    var instance = new __ui_HTML();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_HTML.parse_kwargs = function ( __kwargs, html, wordWrap ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    if (typeof wordWrap == 'undefined')
        wordWrap=__kwargs.wordWrap;
    var __r = [html, wordWrap];
    return __r;
};
function __ui_HTML_initialize() {
    if(__ui_HTML.__was_initialized__) return;
    __ui_HTML.__was_initialized__ = true;
    if(!__ui_Label.__was_initialized__)
        __ui_Label_initialize();
    pyjs_extend(__ui_HTML, __ui_Label);
    __ui_HTML.prototype.__class__.__new__ = ui_HTML;
    __ui_HTML.prototype.__init__ = function(html, wordWrap) {
    if (typeof html == 'undefined') html=null;
    if (typeof wordWrap == 'undefined') wordWrap=true;
    __ui_Label.prototype.__class__.__init__(this);
    this.setElement(DOM_createDiv());
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.MOUSEEVENTS));
    this.setStyleName('gwt-HTML');
    if (html) {
    this.setHTML(html);
    }
    this.setWordWrap(wordWrap);
    };
__ui_HTML.prototype.__init__.parse_kwargs = function ( __kwargs, html, wordWrap ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    if (typeof wordWrap == 'undefined')
        wordWrap=__kwargs.wordWrap;
    var __r = [html, wordWrap];
    return __r;
};
    __ui_HTML.prototype.__class__.__init__ = function() {
        return __ui_HTML.prototype.__init__.call.apply(__ui_HTML.prototype.__init__, arguments);
    };
    __ui_HTML.prototype.__class__.__init__.unbound_method = true;
    __ui_HTML.prototype.__init__.instance_method = true;
    __ui_HTML.prototype.__class__.__init__.parse_kwargs = __ui_HTML.prototype.__init__.parse_kwargs;
    __ui_HTML.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.getElement());
    };
    __ui_HTML.prototype.__class__.getHTML = function() {
        return __ui_HTML.prototype.getHTML.call.apply(__ui_HTML.prototype.getHTML, arguments);
    };
    __ui_HTML.prototype.__class__.getHTML.unbound_method = true;
    __ui_HTML.prototype.getHTML.instance_method = true;
    __ui_HTML.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.getElement(), html);
    };
    __ui_HTML.prototype.__class__.setHTML = function() {
        return __ui_HTML.prototype.setHTML.call.apply(__ui_HTML.prototype.setHTML, arguments);
    };
    __ui_HTML.prototype.__class__.setHTML.unbound_method = true;
    __ui_HTML.prototype.setHTML.instance_method = true;
}
function __ui_HasHorizontalAlignment() {
}
function ui_HasHorizontalAlignment() {
    var instance = new __ui_HasHorizontalAlignment();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HasHorizontalAlignment_initialize() {
    if(__ui_HasHorizontalAlignment.__was_initialized__) return;
    __ui_HasHorizontalAlignment.__was_initialized__ = true;
    pyjs_extend(__ui_HasHorizontalAlignment, __pyjslib_Object);
    __ui_HasHorizontalAlignment.prototype.__class__.__new__ = ui_HasHorizontalAlignment;
    __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_LEFT = 'left';
    __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_CENTER = 'center';
    __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_RIGHT = 'right';
}
function __ui_HasVerticalAlignment() {
}
function ui_HasVerticalAlignment() {
    var instance = new __ui_HasVerticalAlignment();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HasVerticalAlignment_initialize() {
    if(__ui_HasVerticalAlignment.__was_initialized__) return;
    __ui_HasVerticalAlignment.__was_initialized__ = true;
    pyjs_extend(__ui_HasVerticalAlignment, __pyjslib_Object);
    __ui_HasVerticalAlignment.prototype.__class__.__new__ = ui_HasVerticalAlignment;
    __ui_HasVerticalAlignment.prototype.__class__.ALIGN_TOP = 'top';
    __ui_HasVerticalAlignment.prototype.__class__.ALIGN_MIDDLE = 'middle';
    __ui_HasVerticalAlignment.prototype.__class__.ALIGN_BOTTOM = 'bottom';
}
function __ui_HasAlignment() {
}
function ui_HasAlignment() {
    var instance = new __ui_HasAlignment();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HasAlignment_initialize() {
    if(__ui_HasAlignment.__was_initialized__) return;
    __ui_HasAlignment.__was_initialized__ = true;
    pyjs_extend(__ui_HasAlignment, __pyjslib_Object);
    __ui_HasAlignment.prototype.__class__.__new__ = ui_HasAlignment;
    __ui_HasAlignment.prototype.__class__.ALIGN_BOTTOM = 'bottom';
    __ui_HasAlignment.prototype.__class__.ALIGN_MIDDLE = 'middle';
    __ui_HasAlignment.prototype.__class__.ALIGN_TOP = 'top';
    __ui_HasAlignment.prototype.__class__.ALIGN_CENTER = 'center';
    __ui_HasAlignment.prototype.__class__.ALIGN_LEFT = 'left';
    __ui_HasAlignment.prototype.__class__.ALIGN_RIGHT = 'right';
}
function __ui_CellPanel() {
}
function ui_CellPanel() {
    var instance = new __ui_CellPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_CellPanel_initialize() {
    if(__ui_CellPanel.__was_initialized__) return;
    __ui_CellPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_CellPanel, __ui_ComplexPanel);
    __ui_CellPanel.prototype.__class__.__new__ = ui_CellPanel;
    __ui_CellPanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.table = DOM_createTable();
    this.body = DOM_createTBody();
    this.spacing = null;
    this.padding = null;
    DOM_appendChild(this.table, this.body);
    this.setElement(this.table);
    };
    __ui_CellPanel.prototype.__class__.__init__ = function() {
        return __ui_CellPanel.prototype.__init__.call.apply(__ui_CellPanel.prototype.__init__, arguments);
    };
    __ui_CellPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_CellPanel.prototype.__init__.instance_method = true;
    __ui_CellPanel.prototype.getTable = function() {
    return this.table;
    };
    __ui_CellPanel.prototype.__class__.getTable = function() {
        return __ui_CellPanel.prototype.getTable.call.apply(__ui_CellPanel.prototype.getTable, arguments);
    };
    __ui_CellPanel.prototype.__class__.getTable.unbound_method = true;
    __ui_CellPanel.prototype.getTable.instance_method = true;
    __ui_CellPanel.prototype.getBody = function() {
    return this.body;
    };
    __ui_CellPanel.prototype.__class__.getBody = function() {
        return __ui_CellPanel.prototype.getBody.call.apply(__ui_CellPanel.prototype.getBody, arguments);
    };
    __ui_CellPanel.prototype.__class__.getBody.unbound_method = true;
    __ui_CellPanel.prototype.getBody.instance_method = true;
    __ui_CellPanel.prototype.getSpacing = function() {
    return this.spacing;
    };
    __ui_CellPanel.prototype.__class__.getSpacing = function() {
        return __ui_CellPanel.prototype.getSpacing.call.apply(__ui_CellPanel.prototype.getSpacing, arguments);
    };
    __ui_CellPanel.prototype.__class__.getSpacing.unbound_method = true;
    __ui_CellPanel.prototype.getSpacing.instance_method = true;
    __ui_CellPanel.prototype.getPadding = function() {
    return this.padding;
    };
    __ui_CellPanel.prototype.__class__.getPadding = function() {
        return __ui_CellPanel.prototype.getPadding.call.apply(__ui_CellPanel.prototype.getPadding, arguments);
    };
    __ui_CellPanel.prototype.__class__.getPadding.unbound_method = true;
    __ui_CellPanel.prototype.getPadding.instance_method = true;
    __ui_CellPanel.prototype.getWidgetTd = function(widget) {
    if ((widget.getParent() != this)) {
    return;
    }
    return DOM_getParent(widget.getElement());
    };
    __ui_CellPanel.prototype.__class__.getWidgetTd = function() {
        return __ui_CellPanel.prototype.getWidgetTd.call.apply(__ui_CellPanel.prototype.getWidgetTd, arguments);
    };
    __ui_CellPanel.prototype.__class__.getWidgetTd.unbound_method = true;
    __ui_CellPanel.prototype.getWidgetTd.instance_method = true;
    __ui_CellPanel.prototype.setBorderWidth = function(width) {
    DOM_setAttribute(this.table, 'border',  ( '' + width ) );
    };
    __ui_CellPanel.prototype.__class__.setBorderWidth = function() {
        return __ui_CellPanel.prototype.setBorderWidth.call.apply(__ui_CellPanel.prototype.setBorderWidth, arguments);
    };
    __ui_CellPanel.prototype.__class__.setBorderWidth.unbound_method = true;
    __ui_CellPanel.prototype.setBorderWidth.instance_method = true;
    __ui_CellPanel.prototype.setCellHeight = function(widget, height) {
    var td = DOM_getParent(widget.getElement());
    DOM_setAttribute(td, 'height', height);
    };
    __ui_CellPanel.prototype.__class__.setCellHeight = function() {
        return __ui_CellPanel.prototype.setCellHeight.call.apply(__ui_CellPanel.prototype.setCellHeight, arguments);
    };
    __ui_CellPanel.prototype.__class__.setCellHeight.unbound_method = true;
    __ui_CellPanel.prototype.setCellHeight.instance_method = true;
    __ui_CellPanel.prototype.setCellHorizontalAlignment = function(widget, align) {
    var td = this.getWidgetTd(widget);
    if ((td != null)) {
    DOM_setAttribute(td, 'align', align);
    }
    };
    __ui_CellPanel.prototype.__class__.setCellHorizontalAlignment = function() {
        return __ui_CellPanel.prototype.setCellHorizontalAlignment.call.apply(__ui_CellPanel.prototype.setCellHorizontalAlignment, arguments);
    };
    __ui_CellPanel.prototype.__class__.setCellHorizontalAlignment.unbound_method = true;
    __ui_CellPanel.prototype.setCellHorizontalAlignment.instance_method = true;
    __ui_CellPanel.prototype.setCellVerticalAlignment = function(widget, align) {
    var td = this.getWidgetTd(widget);
    if ((td != null)) {
    DOM_setStyleAttribute(td, 'verticalAlign', align);
    }
    };
    __ui_CellPanel.prototype.__class__.setCellVerticalAlignment = function() {
        return __ui_CellPanel.prototype.setCellVerticalAlignment.call.apply(__ui_CellPanel.prototype.setCellVerticalAlignment, arguments);
    };
    __ui_CellPanel.prototype.__class__.setCellVerticalAlignment.unbound_method = true;
    __ui_CellPanel.prototype.setCellVerticalAlignment.instance_method = true;
    __ui_CellPanel.prototype.setCellWidth = function(widget, width) {
    var td = DOM_getParent(widget.getElement());
    DOM_setAttribute(td, 'width', width);
    };
    __ui_CellPanel.prototype.__class__.setCellWidth = function() {
        return __ui_CellPanel.prototype.setCellWidth.call.apply(__ui_CellPanel.prototype.setCellWidth, arguments);
    };
    __ui_CellPanel.prototype.__class__.setCellWidth.unbound_method = true;
    __ui_CellPanel.prototype.setCellWidth.instance_method = true;
    __ui_CellPanel.prototype.setSpacing = function(spacing) {
    this.spacing = spacing;
    DOM_setIntAttribute(this.table, 'cellSpacing', spacing);
    };
    __ui_CellPanel.prototype.__class__.setSpacing = function() {
        return __ui_CellPanel.prototype.setSpacing.call.apply(__ui_CellPanel.prototype.setSpacing, arguments);
    };
    __ui_CellPanel.prototype.__class__.setSpacing.unbound_method = true;
    __ui_CellPanel.prototype.setSpacing.instance_method = true;
    __ui_CellPanel.prototype.setPadding = function(padding) {
    this.padding = padding;
    DOM_setIntAttribute(this.table, 'cellPadding', padding);
    };
    __ui_CellPanel.prototype.__class__.setPadding = function() {
        return __ui_CellPanel.prototype.setPadding.call.apply(__ui_CellPanel.prototype.setPadding, arguments);
    };
    __ui_CellPanel.prototype.__class__.setPadding.unbound_method = true;
    __ui_CellPanel.prototype.setPadding.instance_method = true;
}
function __ui_HorizontalPanel() {
}
function ui_HorizontalPanel() {
    var instance = new __ui_HorizontalPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HorizontalPanel_initialize() {
    if(__ui_HorizontalPanel.__was_initialized__) return;
    __ui_HorizontalPanel.__was_initialized__ = true;
    if(!__ui_CellPanel.__was_initialized__)
        __ui_CellPanel_initialize();
    pyjs_extend(__ui_HorizontalPanel, __ui_CellPanel);
    __ui_HorizontalPanel.prototype.__class__.__new__ = ui_HorizontalPanel;
    __ui_HorizontalPanel.prototype.__init__ = function() {
    __ui_CellPanel.prototype.__class__.__init__(this);
    this.horzAlign = __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_LEFT;
    this.vertAlign = __ui_HasVerticalAlignment.prototype.__class__.ALIGN_TOP;
    this.tableRow = DOM_createTR();
    DOM_appendChild(this.getBody(), this.tableRow);
    DOM_setAttribute(this.getTable(), 'cellSpacing', '0');
    DOM_setAttribute(this.getTable(), 'cellPadding', '0');
    };
    __ui_HorizontalPanel.prototype.__class__.__init__ = function() {
        return __ui_HorizontalPanel.prototype.__init__.call.apply(__ui_HorizontalPanel.prototype.__init__, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_HorizontalPanel.prototype.__init__.instance_method = true;
    __ui_HorizontalPanel.prototype.add = function(widget) {
    this.insert(widget, this.getWidgetCount());
    };
    __ui_HorizontalPanel.prototype.__class__.add = function() {
        return __ui_HorizontalPanel.prototype.add.call.apply(__ui_HorizontalPanel.prototype.add, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.add.unbound_method = true;
    __ui_HorizontalPanel.prototype.add.instance_method = true;
    __ui_HorizontalPanel.prototype.getHorizontalAlignment = function() {
    return this.horzAlign;
    };
    __ui_HorizontalPanel.prototype.__class__.getHorizontalAlignment = function() {
        return __ui_HorizontalPanel.prototype.getHorizontalAlignment.call.apply(__ui_HorizontalPanel.prototype.getHorizontalAlignment, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getHorizontalAlignment.unbound_method = true;
    __ui_HorizontalPanel.prototype.getHorizontalAlignment.instance_method = true;
    __ui_HorizontalPanel.prototype.getVerticalAlignment = function() {
    return this.vertAlign;
    };
    __ui_HorizontalPanel.prototype.__class__.getVerticalAlignment = function() {
        return __ui_HorizontalPanel.prototype.getVerticalAlignment.call.apply(__ui_HorizontalPanel.prototype.getVerticalAlignment, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getVerticalAlignment.unbound_method = true;
    __ui_HorizontalPanel.prototype.getVerticalAlignment.instance_method = true;
    __ui_HorizontalPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidget = function() {
        return __ui_HorizontalPanel.prototype.getWidget.call.apply(__ui_HorizontalPanel.prototype.getWidget, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_HorizontalPanel.prototype.getWidget.instance_method = true;
    __ui_HorizontalPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_HorizontalPanel.prototype.getWidgetCount.call.apply(__ui_HorizontalPanel.prototype.getWidgetCount, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_HorizontalPanel.prototype.getWidgetCount.instance_method = true;
    __ui_HorizontalPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_HorizontalPanel.prototype.getWidgetIndex.call.apply(__ui_HorizontalPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_HorizontalPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_HorizontalPanel.prototype.insert = function(widget, beforeIndex) {
    widget.removeFromParent();
    var td = DOM_createTD();
    DOM_insertChild(this.tableRow, td, beforeIndex);
    __ui_CellPanel.prototype.__class__.insert(this, widget, td, beforeIndex);
    this.setCellHorizontalAlignment(widget, this.horzAlign);
    this.setCellVerticalAlignment(widget, this.vertAlign);
    };
    __ui_HorizontalPanel.prototype.__class__.insert = function() {
        return __ui_HorizontalPanel.prototype.insert.call.apply(__ui_HorizontalPanel.prototype.insert, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.insert.unbound_method = true;
    __ui_HorizontalPanel.prototype.insert.instance_method = true;
    __ui_HorizontalPanel.prototype.remove = function(widget) {
    if (pyjslib_isNumber(widget)) {
    var widget = this.getWidget(widget);
    }
    if ((widget.getParent() != this)) {
    return false;
    }
    var td = DOM_getParent(widget.getElement());
    DOM_removeChild(this.tableRow, td);
    __ui_CellPanel.prototype.__class__.remove(this, widget);
    return true;
    };
    __ui_HorizontalPanel.prototype.__class__.remove = function() {
        return __ui_HorizontalPanel.prototype.remove.call.apply(__ui_HorizontalPanel.prototype.remove, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.remove.unbound_method = true;
    __ui_HorizontalPanel.prototype.remove.instance_method = true;
    __ui_HorizontalPanel.prototype.setHorizontalAlignment = function(align) {
    this.horzAlign = align;
    };
    __ui_HorizontalPanel.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_HorizontalPanel.prototype.setHorizontalAlignment.call.apply(__ui_HorizontalPanel.prototype.setHorizontalAlignment, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_HorizontalPanel.prototype.setHorizontalAlignment.instance_method = true;
    __ui_HorizontalPanel.prototype.setVerticalAlignment = function(align) {
    this.vertAlign = align;
    };
    __ui_HorizontalPanel.prototype.__class__.setVerticalAlignment = function() {
        return __ui_HorizontalPanel.prototype.setVerticalAlignment.call.apply(__ui_HorizontalPanel.prototype.setVerticalAlignment, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.setVerticalAlignment.unbound_method = true;
    __ui_HorizontalPanel.prototype.setVerticalAlignment.instance_method = true;
}
function __ui_VerticalPanel() {
}
function ui_VerticalPanel() {
    var instance = new __ui_VerticalPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_VerticalPanel_initialize() {
    if(__ui_VerticalPanel.__was_initialized__) return;
    __ui_VerticalPanel.__was_initialized__ = true;
    if(!__ui_CellPanel.__was_initialized__)
        __ui_CellPanel_initialize();
    pyjs_extend(__ui_VerticalPanel, __ui_CellPanel);
    __ui_VerticalPanel.prototype.__class__.__new__ = ui_VerticalPanel;
    __ui_VerticalPanel.prototype.__init__ = function() {
    __ui_CellPanel.prototype.__class__.__init__(this);
    this.horzAlign = __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_LEFT;
    this.vertAlign = __ui_HasVerticalAlignment.prototype.__class__.ALIGN_TOP;
    DOM_setAttribute(this.getTable(), 'cellSpacing', '0');
    DOM_setAttribute(this.getTable(), 'cellPadding', '0');
    };
    __ui_VerticalPanel.prototype.__class__.__init__ = function() {
        return __ui_VerticalPanel.prototype.__init__.call.apply(__ui_VerticalPanel.prototype.__init__, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_VerticalPanel.prototype.__init__.instance_method = true;
    __ui_VerticalPanel.prototype.add = function(widget) {
    this.insert(widget, this.getWidgetCount());
    };
    __ui_VerticalPanel.prototype.__class__.add = function() {
        return __ui_VerticalPanel.prototype.add.call.apply(__ui_VerticalPanel.prototype.add, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.add.unbound_method = true;
    __ui_VerticalPanel.prototype.add.instance_method = true;
    __ui_VerticalPanel.prototype.getHorizontalAlignment = function() {
    return this.horzAlign;
    };
    __ui_VerticalPanel.prototype.__class__.getHorizontalAlignment = function() {
        return __ui_VerticalPanel.prototype.getHorizontalAlignment.call.apply(__ui_VerticalPanel.prototype.getHorizontalAlignment, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getHorizontalAlignment.unbound_method = true;
    __ui_VerticalPanel.prototype.getHorizontalAlignment.instance_method = true;
    __ui_VerticalPanel.prototype.getVerticalAlignment = function() {
    return this.vertAlign;
    };
    __ui_VerticalPanel.prototype.__class__.getVerticalAlignment = function() {
        return __ui_VerticalPanel.prototype.getVerticalAlignment.call.apply(__ui_VerticalPanel.prototype.getVerticalAlignment, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getVerticalAlignment.unbound_method = true;
    __ui_VerticalPanel.prototype.getVerticalAlignment.instance_method = true;
    __ui_VerticalPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_VerticalPanel.prototype.__class__.getWidget = function() {
        return __ui_VerticalPanel.prototype.getWidget.call.apply(__ui_VerticalPanel.prototype.getWidget, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_VerticalPanel.prototype.getWidget.instance_method = true;
    __ui_VerticalPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_VerticalPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_VerticalPanel.prototype.getWidgetCount.call.apply(__ui_VerticalPanel.prototype.getWidgetCount, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_VerticalPanel.prototype.getWidgetCount.instance_method = true;
    __ui_VerticalPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_VerticalPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_VerticalPanel.prototype.getWidgetIndex.call.apply(__ui_VerticalPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_VerticalPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_VerticalPanel.prototype.setWidget = function(index, widget) {
    var existing = this.getWidget(index);
    if (existing) {
    this.remove(existing);
    }
    this.insert(widget, index);
    };
    __ui_VerticalPanel.prototype.__class__.setWidget = function() {
        return __ui_VerticalPanel.prototype.setWidget.call.apply(__ui_VerticalPanel.prototype.setWidget, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.setWidget.unbound_method = true;
    __ui_VerticalPanel.prototype.setWidget.instance_method = true;
    __ui_VerticalPanel.prototype.insert = function(widget, beforeIndex) {
    widget.removeFromParent();
    var tr = DOM_createTR();
    var td = DOM_createTD();
    DOM_insertChild(this.getBody(), tr, beforeIndex);
    DOM_appendChild(tr, td);
    __ui_CellPanel.prototype.__class__.insert(this, widget, td, beforeIndex);
    this.setCellHorizontalAlignment(widget, this.horzAlign);
    this.setCellVerticalAlignment(widget, this.vertAlign);
    };
    __ui_VerticalPanel.prototype.__class__.insert = function() {
        return __ui_VerticalPanel.prototype.insert.call.apply(__ui_VerticalPanel.prototype.insert, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.insert.unbound_method = true;
    __ui_VerticalPanel.prototype.insert.instance_method = true;
    __ui_VerticalPanel.prototype.remove = function(widget) {
    if (pyjslib_isNumber(widget)) {
    var widget = this.getWidget(widget);
    }
    if ((widget.getParent() != this)) {
    return false;
    }
    var td = DOM_getParent(widget.getElement());
    var tr = DOM_getParent(td);
    DOM_removeChild(this.getBody(), tr);
    __ui_CellPanel.prototype.__class__.remove(this, widget);
    return true;
    };
    __ui_VerticalPanel.prototype.__class__.remove = function() {
        return __ui_VerticalPanel.prototype.remove.call.apply(__ui_VerticalPanel.prototype.remove, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.remove.unbound_method = true;
    __ui_VerticalPanel.prototype.remove.instance_method = true;
    __ui_VerticalPanel.prototype.setHorizontalAlignment = function(align) {
    this.horzAlign = align;
    };
    __ui_VerticalPanel.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_VerticalPanel.prototype.setHorizontalAlignment.call.apply(__ui_VerticalPanel.prototype.setHorizontalAlignment, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_VerticalPanel.prototype.setHorizontalAlignment.instance_method = true;
    __ui_VerticalPanel.prototype.setVerticalAlignment = function(align) {
    this.vertAlign = align;
    };
    __ui_VerticalPanel.prototype.__class__.setVerticalAlignment = function() {
        return __ui_VerticalPanel.prototype.setVerticalAlignment.call.apply(__ui_VerticalPanel.prototype.setVerticalAlignment, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.setVerticalAlignment.unbound_method = true;
    __ui_VerticalPanel.prototype.setVerticalAlignment.instance_method = true;
}
function __ui_LayoutData() {
}
function ui_LayoutData(direction) {
    var instance = new __ui_LayoutData();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_LayoutData_initialize() {
    if(__ui_LayoutData.__was_initialized__) return;
    __ui_LayoutData.__was_initialized__ = true;
    pyjs_extend(__ui_LayoutData, __pyjslib_Object);
    __ui_LayoutData.prototype.__class__.__new__ = ui_LayoutData;
    __ui_LayoutData.prototype.__init__ = function(direction) {
    this.direction = direction;
    this.hAlign = 'left';
    this.height = '';
    this.td = null;
    this.vAlign = 'top';
    this.width = '';
    };
    __ui_LayoutData.prototype.__class__.__init__ = function() {
        return __ui_LayoutData.prototype.__init__.call.apply(__ui_LayoutData.prototype.__init__, arguments);
    };
    __ui_LayoutData.prototype.__class__.__init__.unbound_method = true;
    __ui_LayoutData.prototype.__init__.instance_method = true;
}
function __ui_DockPanel() {
}
function ui_DockPanel() {
    var instance = new __ui_DockPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DockPanel_initialize() {
    if(__ui_DockPanel.__was_initialized__) return;
    __ui_DockPanel.__was_initialized__ = true;
    if(!__ui_CellPanel.__was_initialized__)
        __ui_CellPanel_initialize();
    pyjs_extend(__ui_DockPanel, __ui_CellPanel);
    __ui_DockPanel.prototype.__class__.__new__ = ui_DockPanel;
    __ui_DockPanel.prototype.__class__.CENTER = 'center';
    __ui_DockPanel.prototype.__class__.EAST = 'east';
    __ui_DockPanel.prototype.__class__.NORTH = 'north';
    __ui_DockPanel.prototype.__class__.SOUTH = 'south';
    __ui_DockPanel.prototype.__class__.WEST = 'west';
    __ui_DockPanel.prototype.__init__ = function() {
    __ui_CellPanel.prototype.__class__.__init__(this);
    this.horzAlign = __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_LEFT;
    this.vertAlign = __ui_HasVerticalAlignment.prototype.__class__.ALIGN_TOP;
    this.center = null;
    this.dock_children = new pyjslib_List([]);
    DOM_setIntAttribute(this.getTable(), 'cellSpacing', 0);
    DOM_setIntAttribute(this.getTable(), 'cellPadding', 0);
    };
    __ui_DockPanel.prototype.__class__.__init__ = function() {
        return __ui_DockPanel.prototype.__init__.call.apply(__ui_DockPanel.prototype.__init__, arguments);
    };
    __ui_DockPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_DockPanel.prototype.__init__.instance_method = true;
    __ui_DockPanel.prototype.add = function(widget, direction) {
    if ((direction == this.CENTER)) {
    if ((this.center != null)) {
    console.error('Only one CENTER widget may be added');
    }
    this.center = widget;
    }
    var layout = ui_LayoutData(direction);
    widget.setLayoutData(layout);
    this.setCellHorizontalAlignment(widget, this.horzAlign);
    this.setCellVerticalAlignment(widget, this.vertAlign);
    this.dock_children.append(widget);
    this.realizeTable(widget);
    };
    __ui_DockPanel.prototype.__class__.add = function() {
        return __ui_DockPanel.prototype.add.call.apply(__ui_DockPanel.prototype.add, arguments);
    };
    __ui_DockPanel.prototype.__class__.add.unbound_method = true;
    __ui_DockPanel.prototype.add.instance_method = true;
    __ui_DockPanel.prototype.getHorizontalAlignment = function() {
    return this.horzAlign;
    };
    __ui_DockPanel.prototype.__class__.getHorizontalAlignment = function() {
        return __ui_DockPanel.prototype.getHorizontalAlignment.call.apply(__ui_DockPanel.prototype.getHorizontalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.getHorizontalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.getHorizontalAlignment.instance_method = true;
    __ui_DockPanel.prototype.getVerticalAlignment = function() {
    return this.vertAlign;
    };
    __ui_DockPanel.prototype.__class__.getVerticalAlignment = function() {
        return __ui_DockPanel.prototype.getVerticalAlignment.call.apply(__ui_DockPanel.prototype.getVerticalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.getVerticalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.getVerticalAlignment.instance_method = true;
    __ui_DockPanel.prototype.getWidgetDirection = function(widget) {
    if ((widget.getParent() != this)) {
    return;
    }
    return widget.getLayoutData().direction;
    };
    __ui_DockPanel.prototype.__class__.getWidgetDirection = function() {
        return __ui_DockPanel.prototype.getWidgetDirection.call.apply(__ui_DockPanel.prototype.getWidgetDirection, arguments);
    };
    __ui_DockPanel.prototype.__class__.getWidgetDirection.unbound_method = true;
    __ui_DockPanel.prototype.getWidgetDirection.instance_method = true;
    __ui_DockPanel.prototype.remove = function(widget) {
    if ((widget == this.center)) {
    this.center = null;
    }
    var ret = __ui_CellPanel.prototype.__class__.remove(this, widget);
    if (ret) {
    this.dock_children.remove(widget);
    this.realizeTable(null);
    }
    return ret;
    };
    __ui_DockPanel.prototype.__class__.remove = function() {
        return __ui_DockPanel.prototype.remove.call.apply(__ui_DockPanel.prototype.remove, arguments);
    };
    __ui_DockPanel.prototype.__class__.remove.unbound_method = true;
    __ui_DockPanel.prototype.remove.instance_method = true;
    __ui_DockPanel.prototype.setCellHeight = function(widget, height) {
    var data = widget.getLayoutData();
    data.height = height;
    if (data.td) {
    DOM_setStyleAttribute(data.td, 'height', data.height);
    }
    };
    __ui_DockPanel.prototype.__class__.setCellHeight = function() {
        return __ui_DockPanel.prototype.setCellHeight.call.apply(__ui_DockPanel.prototype.setCellHeight, arguments);
    };
    __ui_DockPanel.prototype.__class__.setCellHeight.unbound_method = true;
    __ui_DockPanel.prototype.setCellHeight.instance_method = true;
    __ui_DockPanel.prototype.setCellHorizontalAlignment = function(widget, align) {
    var data = widget.getLayoutData();
    data.hAlign = align;
    if (data.td) {
    DOM_setAttribute(data.td, 'align', data.hAlign);
    }
    };
    __ui_DockPanel.prototype.__class__.setCellHorizontalAlignment = function() {
        return __ui_DockPanel.prototype.setCellHorizontalAlignment.call.apply(__ui_DockPanel.prototype.setCellHorizontalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.setCellHorizontalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.setCellHorizontalAlignment.instance_method = true;
    __ui_DockPanel.prototype.setCellVerticalAlignment = function(widget, align) {
    var data = widget.getLayoutData();
    data.vAlign = align;
    if (data.td) {
    DOM_setStyleAttribute(data.td, 'verticalAlign', data.vAlign);
    }
    };
    __ui_DockPanel.prototype.__class__.setCellVerticalAlignment = function() {
        return __ui_DockPanel.prototype.setCellVerticalAlignment.call.apply(__ui_DockPanel.prototype.setCellVerticalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.setCellVerticalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.setCellVerticalAlignment.instance_method = true;
    __ui_DockPanel.prototype.setCellWidth = function(widget, width) {
    var data = widget.getLayoutData();
    data.width = width;
    if (data.td) {
    DOM_setStyleAttribute(data.td, 'width', data.width);
    }
    };
    __ui_DockPanel.prototype.__class__.setCellWidth = function() {
        return __ui_DockPanel.prototype.setCellWidth.call.apply(__ui_DockPanel.prototype.setCellWidth, arguments);
    };
    __ui_DockPanel.prototype.__class__.setCellWidth.unbound_method = true;
    __ui_DockPanel.prototype.setCellWidth.instance_method = true;
    __ui_DockPanel.prototype.setHorizontalAlignment = function(align) {
    this.horzAlign = align;
    };
    __ui_DockPanel.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_DockPanel.prototype.setHorizontalAlignment.call.apply(__ui_DockPanel.prototype.setHorizontalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.setHorizontalAlignment.instance_method = true;
    __ui_DockPanel.prototype.setVerticalAlignment = function(align) {
    this.vertAlign = align;
    };
    __ui_DockPanel.prototype.__class__.setVerticalAlignment = function() {
        return __ui_DockPanel.prototype.setVerticalAlignment.call.apply(__ui_DockPanel.prototype.setVerticalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.setVerticalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.setVerticalAlignment.instance_method = true;
    __ui_DockPanel.prototype.realizeTable = function(beingAdded) {
    var bodyElement = this.getBody();
    while ((DOM_getChildCount(bodyElement) > 0)) {
    DOM_removeChild(bodyElement, DOM_getChild(bodyElement, 0));
    }
    var rowCount = 1;
    var colCount = 1;

        var __child = this.dock_children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    var dir = child.getLayoutData().direction;
    if (((dir == this.NORTH)) || ((dir == this.SOUTH))) {
    rowCount += 1;
    }
    else if (((dir == this.EAST)) || ((dir == this.WEST))) {
    colCount += 1;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    var rows = new pyjslib_List([]);

        var __i = pyjslib_range(rowCount).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    rows.__setitem__(i, ui_DockPanelTmpRow());
    rows.__getitem__(i).tr = DOM_createTR();
    DOM_appendChild(bodyElement, rows.__getitem__(i).tr);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    var westCol = 0;
    var eastCol =  ( colCount - 1 ) ;
    var northRow = 0;
    var southRow =  ( rowCount - 1 ) ;
    var centerTd = null;

        var __child = this.dock_children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    var layout = child.getLayoutData();
    var td = DOM_createTD();
    layout.td = td;
    DOM_setAttribute(layout.td, 'align', layout.hAlign);
    DOM_setStyleAttribute(layout.td, 'verticalAlign', layout.vAlign);
    DOM_setAttribute(layout.td, 'width', layout.width);
    DOM_setAttribute(layout.td, 'height', layout.height);
    if ((layout.direction == this.NORTH)) {
    DOM_insertChild(rows.__getitem__(northRow).tr, td, rows.__getitem__(northRow).center);
    this.appendAndMaybeAdopt(td, child.getElement(), beingAdded);
    DOM_setIntAttribute(td, 'colSpan',  (  ( eastCol - westCol )  + 1 ) );
    northRow += 1;
    }
    else if ((layout.direction == this.SOUTH)) {
    DOM_insertChild(rows.__getitem__(southRow).tr, td, rows.__getitem__(southRow).center);
    this.appendAndMaybeAdopt(td, child.getElement(), beingAdded);
    DOM_setIntAttribute(td, 'colSpan',  (  ( eastCol - westCol )  + 1 ) );
    southRow -= 1;
    }
    else if ((layout.direction == this.WEST)) {
    var row = rows.__getitem__(northRow);
    DOM_insertChild(row.tr, td, row.center);
    row.center += 1;
    this.appendAndMaybeAdopt(td, child.getElement(), beingAdded);
    DOM_setIntAttribute(td, 'rowSpan',  (  ( southRow - northRow )  + 1 ) );
    westCol += 1;
    }
    else if ((layout.direction == this.EAST)) {
    var row = rows.__getitem__(northRow);
    DOM_insertChild(row.tr, td, row.center);
    this.appendAndMaybeAdopt(td, child.getElement(), beingAdded);
    DOM_setIntAttribute(td, 'rowSpan',  (  ( southRow - northRow )  + 1 ) );
    eastCol -= 1;
    }
    else if ((layout.direction == this.CENTER)) {
    var centerTd = td;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    if ((this.center != null)) {
    var row = rows.__getitem__(northRow);
    DOM_insertChild(row.tr, centerTd, row.center);
    this.appendAndMaybeAdopt(centerTd, this.center.getElement(), beingAdded);
    }
    };
    __ui_DockPanel.prototype.__class__.realizeTable = function() {
        return __ui_DockPanel.prototype.realizeTable.call.apply(__ui_DockPanel.prototype.realizeTable, arguments);
    };
    __ui_DockPanel.prototype.__class__.realizeTable.unbound_method = true;
    __ui_DockPanel.prototype.realizeTable.instance_method = true;
    __ui_DockPanel.prototype.appendAndMaybeAdopt = function(parent, child, beingAdded) {
    if ((beingAdded != null)) {
    if (DOM_compare(child, beingAdded.getElement())) {
    __ui_CellPanel.prototype.__class__.add(this, beingAdded, parent);
    return;
    }
    }
    DOM_appendChild(parent, child);
    };
    __ui_DockPanel.prototype.__class__.appendAndMaybeAdopt = function() {
        return __ui_DockPanel.prototype.appendAndMaybeAdopt.call.apply(__ui_DockPanel.prototype.appendAndMaybeAdopt, arguments);
    };
    __ui_DockPanel.prototype.__class__.appendAndMaybeAdopt.unbound_method = true;
    __ui_DockPanel.prototype.appendAndMaybeAdopt.instance_method = true;
}
function __ui_DockPanelTmpRow() {
}
function ui_DockPanelTmpRow() {
    var instance = new __ui_DockPanelTmpRow();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DockPanelTmpRow_initialize() {
    if(__ui_DockPanelTmpRow.__was_initialized__) return;
    __ui_DockPanelTmpRow.__was_initialized__ = true;
    pyjs_extend(__ui_DockPanelTmpRow, __pyjslib_Object);
    __ui_DockPanelTmpRow.prototype.__class__.__new__ = ui_DockPanelTmpRow;
    __ui_DockPanelTmpRow.prototype.__class__.center = 0;
    __ui_DockPanelTmpRow.prototype.__class__.tr = null;
}
    var ui_rootPanels = new pyjslib_Dict([]);
function __ui_RootPanelCls() {
}
function ui_RootPanelCls(element) {
    if (typeof element == 'undefined') element=null;
    var instance = new __ui_RootPanelCls();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_RootPanelCls.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
function __ui_RootPanelCls_initialize() {
    if(__ui_RootPanelCls.__was_initialized__) return;
    __ui_RootPanelCls.__was_initialized__ = true;
    if(!__ui_AbsolutePanel.__was_initialized__)
        __ui_AbsolutePanel_initialize();
    pyjs_extend(__ui_RootPanelCls, __ui_AbsolutePanel);
    __ui_RootPanelCls.prototype.__class__.__new__ = ui_RootPanelCls;
    __ui_RootPanelCls.prototype.__init__ = function(element) {
    if (typeof element == 'undefined') element=null;
    __ui_AbsolutePanel.prototype.__class__.__init__(this);
    if ((element == null)) {
    var element = this.getBodyElement();
    }
    this.setElement(element);
    this.onAttach();
    };
__ui_RootPanelCls.prototype.__init__.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
    __ui_RootPanelCls.prototype.__class__.__init__ = function() {
        return __ui_RootPanelCls.prototype.__init__.call.apply(__ui_RootPanelCls.prototype.__init__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.__init__.unbound_method = true;
    __ui_RootPanelCls.prototype.__init__.instance_method = true;
    __ui_RootPanelCls.prototype.__class__.__init__.parse_kwargs = __ui_RootPanelCls.prototype.__init__.parse_kwargs;
    __ui_RootPanelCls.prototype.getBodyElement = function() {

        return $doc.body;
        
    };
    __ui_RootPanelCls.prototype.__class__.getBodyElement = function() {
        return __ui_RootPanelCls.prototype.getBodyElement.call.apply(__ui_RootPanelCls.prototype.getBodyElement, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.getBodyElement.unbound_method = true;
    __ui_RootPanelCls.prototype.getBodyElement.instance_method = true;
    __ui_RootPanelCls.prototype.__class__.get = function(id) {
    if (typeof id == 'undefined') id=null;
    if (ui_rootPanels.has_key(id)) {
    return ui_rootPanels.__getitem__(id);
    }
    var element = null;
    if (id) {
    var element = DOM_getElementById(id);
    if (!(element)) {
    return;
    }
    }
    if ((pyjslib_len(ui_rootPanels) < 1)) {
    this.hookWindowClosing();
    }
    var panel = ui_RootPanel(element);
    ui_rootPanels.__setitem__(id, panel);
    return panel;
    };
__ui_RootPanelCls.prototype.__class__.get.parse_kwargs = function ( __kwargs, id ) {
    if (typeof id == 'undefined')
        id=__kwargs.id;
    var __r = [id];
    return __r;
};
    __ui_RootPanelCls.prototype.get = function() {
        return __ui_RootPanelCls.prototype.__class__.get.apply(this.__class__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.get.class_method = true;
    __ui_RootPanelCls.prototype.get.instance_method = true;
    __ui_RootPanelCls.prototype.get.parse_kwargs = __ui_RootPanelCls.prototype.__class__.get.parse_kwargs;
    __ui_RootPanelCls.prototype.__class__.hookWindowClosing = function() {
    Window_addWindowCloseListener(this);
    };
    __ui_RootPanelCls.prototype.hookWindowClosing = function() {
        return __ui_RootPanelCls.prototype.__class__.hookWindowClosing.apply(this.__class__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.hookWindowClosing.class_method = true;
    __ui_RootPanelCls.prototype.hookWindowClosing.instance_method = true;
    __ui_RootPanelCls.prototype.__class__.onWindowClosed = function() {

        var __panel = ui_rootPanels.itervalues().__iter__();
        try {
            while (true) {
                var panel = __panel.next();
                
        
    panel.onDetach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_RootPanelCls.prototype.onWindowClosed = function() {
        return __ui_RootPanelCls.prototype.__class__.onWindowClosed.apply(this.__class__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.onWindowClosed.class_method = true;
    __ui_RootPanelCls.prototype.onWindowClosed.instance_method = true;
    __ui_RootPanelCls.prototype.__class__.onWindowClosing = function() {
    return;
    };
    __ui_RootPanelCls.prototype.onWindowClosing = function() {
        return __ui_RootPanelCls.prototype.__class__.onWindowClosing.apply(this.__class__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.onWindowClosing.class_method = true;
    __ui_RootPanelCls.prototype.onWindowClosing.instance_method = true;
}
function ui_RootPanel(element) {
    if (pyjslib_isString(element)) {
    return ui_RootPanelCls().get(element);
    }
    return ui_RootPanelCls(element);
}


function __ui_Hyperlink() {
}
function ui_Hyperlink(text, asHTML, targetHistoryToken) {
    if (typeof text == 'undefined') text='';
    if (typeof asHTML == 'undefined') asHTML=false;
    if (typeof targetHistoryToken == 'undefined') targetHistoryToken='';
    var instance = new __ui_Hyperlink();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Hyperlink.parse_kwargs = function ( __kwargs, text, asHTML, targetHistoryToken ) {
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    if (typeof targetHistoryToken == 'undefined')
        targetHistoryToken=__kwargs.targetHistoryToken;
    var __r = [text, asHTML, targetHistoryToken];
    return __r;
};
function __ui_Hyperlink_initialize() {
    if(__ui_Hyperlink.__was_initialized__) return;
    __ui_Hyperlink.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Hyperlink, __ui_Widget);
    __ui_Hyperlink.prototype.__class__.__new__ = ui_Hyperlink;
    __ui_Hyperlink.prototype.__init__ = function(text, asHTML, targetHistoryToken) {
    if (typeof text == 'undefined') text='';
    if (typeof asHTML == 'undefined') asHTML=false;
    if (typeof targetHistoryToken == 'undefined') targetHistoryToken='';
    __ui_Widget.prototype.__class__.__init__(this);
    this.clickListeners = new pyjslib_List([]);
    this.targetHistoryToken = '';
    this.setElement(DOM_createDiv());
    this.anchorElem = DOM_createAnchor();
    DOM_appendChild(this.getElement(), this.anchorElem);
    this.sinkEvents(__ui_Event.prototype.__class__.ONCLICK);
    this.setStyleName('gwt-Hyperlink');
    if (asHTML) {
    this.setHTML(text);
    }
    else {
    this.setText(text);
    }
    if (targetHistoryToken) {
    this.setTargetHistoryToken(targetHistoryToken);
    }
    };
__ui_Hyperlink.prototype.__init__.parse_kwargs = function ( __kwargs, text, asHTML, targetHistoryToken ) {
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    if (typeof targetHistoryToken == 'undefined')
        targetHistoryToken=__kwargs.targetHistoryToken;
    var __r = [text, asHTML, targetHistoryToken];
    return __r;
};
    __ui_Hyperlink.prototype.__class__.__init__ = function() {
        return __ui_Hyperlink.prototype.__init__.call.apply(__ui_Hyperlink.prototype.__init__, arguments);
    };
    __ui_Hyperlink.prototype.__class__.__init__.unbound_method = true;
    __ui_Hyperlink.prototype.__init__.instance_method = true;
    __ui_Hyperlink.prototype.__class__.__init__.parse_kwargs = __ui_Hyperlink.prototype.__init__.parse_kwargs;
    __ui_Hyperlink.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_Hyperlink.prototype.__class__.addClickListener = function() {
        return __ui_Hyperlink.prototype.addClickListener.call.apply(__ui_Hyperlink.prototype.addClickListener, arguments);
    };
    __ui_Hyperlink.prototype.__class__.addClickListener.unbound_method = true;
    __ui_Hyperlink.prototype.addClickListener.instance_method = true;
    __ui_Hyperlink.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.anchorElem);
    };
    __ui_Hyperlink.prototype.__class__.getHTML = function() {
        return __ui_Hyperlink.prototype.getHTML.call.apply(__ui_Hyperlink.prototype.getHTML, arguments);
    };
    __ui_Hyperlink.prototype.__class__.getHTML.unbound_method = true;
    __ui_Hyperlink.prototype.getHTML.instance_method = true;
    __ui_Hyperlink.prototype.getTargetHistoryToken = function() {
    return this.targetHistoryToken;
    };
    __ui_Hyperlink.prototype.__class__.getTargetHistoryToken = function() {
        return __ui_Hyperlink.prototype.getTargetHistoryToken.call.apply(__ui_Hyperlink.prototype.getTargetHistoryToken, arguments);
    };
    __ui_Hyperlink.prototype.__class__.getTargetHistoryToken.unbound_method = true;
    __ui_Hyperlink.prototype.getTargetHistoryToken.instance_method = true;
    __ui_Hyperlink.prototype.getText = function() {
    return DOM_getInnerText(this.anchorElem);
    };
    __ui_Hyperlink.prototype.__class__.getText = function() {
        return __ui_Hyperlink.prototype.getText.call.apply(__ui_Hyperlink.prototype.getText, arguments);
    };
    __ui_Hyperlink.prototype.__class__.getText.unbound_method = true;
    __ui_Hyperlink.prototype.getText.instance_method = true;
    __ui_Hyperlink.prototype.onBrowserEvent = function(event) {
    if ((DOM_eventGetType(event) == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onClick) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    History_History().newItem(this.targetHistoryToken);
    DOM_eventPreventDefault(event);
    }
    };
    __ui_Hyperlink.prototype.__class__.onBrowserEvent = function() {
        return __ui_Hyperlink.prototype.onBrowserEvent.call.apply(__ui_Hyperlink.prototype.onBrowserEvent, arguments);
    };
    __ui_Hyperlink.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Hyperlink.prototype.onBrowserEvent.instance_method = true;
    __ui_Hyperlink.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_Hyperlink.prototype.__class__.removeClickListener = function() {
        return __ui_Hyperlink.prototype.removeClickListener.call.apply(__ui_Hyperlink.prototype.removeClickListener, arguments);
    };
    __ui_Hyperlink.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_Hyperlink.prototype.removeClickListener.instance_method = true;
    __ui_Hyperlink.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.anchorElem, html);
    };
    __ui_Hyperlink.prototype.__class__.setHTML = function() {
        return __ui_Hyperlink.prototype.setHTML.call.apply(__ui_Hyperlink.prototype.setHTML, arguments);
    };
    __ui_Hyperlink.prototype.__class__.setHTML.unbound_method = true;
    __ui_Hyperlink.prototype.setHTML.instance_method = true;
    __ui_Hyperlink.prototype.setTargetHistoryToken = function(targetHistoryToken) {
    this.targetHistoryToken = targetHistoryToken;
    DOM_setAttribute(this.anchorElem, 'href',  ( '#' + targetHistoryToken ) );
    };
    __ui_Hyperlink.prototype.__class__.setTargetHistoryToken = function() {
        return __ui_Hyperlink.prototype.setTargetHistoryToken.call.apply(__ui_Hyperlink.prototype.setTargetHistoryToken, arguments);
    };
    __ui_Hyperlink.prototype.__class__.setTargetHistoryToken.unbound_method = true;
    __ui_Hyperlink.prototype.setTargetHistoryToken.instance_method = true;
    __ui_Hyperlink.prototype.setText = function(text) {
    DOM_setInnerText(this.anchorElem, text);
    };
    __ui_Hyperlink.prototype.__class__.setText = function() {
        return __ui_Hyperlink.prototype.setText.call.apply(__ui_Hyperlink.prototype.setText, arguments);
    };
    __ui_Hyperlink.prototype.__class__.setText.unbound_method = true;
    __ui_Hyperlink.prototype.setText.instance_method = true;
}
    var ui_prefetchImages = new pyjslib_Dict([]);
function __ui_Image() {
}
function ui_Image(url) {
    if (typeof url == 'undefined') url='';
    var instance = new __ui_Image();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Image.parse_kwargs = function ( __kwargs, url ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    var __r = [url];
    return __r;
};
function __ui_Image_initialize() {
    if(__ui_Image.__was_initialized__) return;
    __ui_Image.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Image, __ui_Widget);
    __ui_Image.prototype.__class__.__new__ = ui_Image;
    __ui_Image.prototype.__init__ = function(url) {
    if (typeof url == 'undefined') url='';
    __ui_Widget.prototype.__class__.__init__(this);
    this.clickListeners = new pyjslib_List([]);
    this.loadListeners = new pyjslib_List([]);
    this.mouseListeners = new pyjslib_List([]);
    this.setElement(DOM_createImg());
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.MOUSEEVENTS | __ui_Event.prototype.__class__.ONLOAD | __ui_Event.prototype.__class__.ONERROR));
    this.setStyleName('gwt-Image');
    if (url) {
    this.setUrl(url);
    }
    };
__ui_Image.prototype.__init__.parse_kwargs = function ( __kwargs, url ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    var __r = [url];
    return __r;
};
    __ui_Image.prototype.__class__.__init__ = function() {
        return __ui_Image.prototype.__init__.call.apply(__ui_Image.prototype.__init__, arguments);
    };
    __ui_Image.prototype.__class__.__init__.unbound_method = true;
    __ui_Image.prototype.__init__.instance_method = true;
    __ui_Image.prototype.__class__.__init__.parse_kwargs = __ui_Image.prototype.__init__.parse_kwargs;
    __ui_Image.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_Image.prototype.__class__.addClickListener = function() {
        return __ui_Image.prototype.addClickListener.call.apply(__ui_Image.prototype.addClickListener, arguments);
    };
    __ui_Image.prototype.__class__.addClickListener.unbound_method = true;
    __ui_Image.prototype.addClickListener.instance_method = true;
    __ui_Image.prototype.addLoadListener = function(listener) {
    this.loadListeners.append(listener);
    };
    __ui_Image.prototype.__class__.addLoadListener = function() {
        return __ui_Image.prototype.addLoadListener.call.apply(__ui_Image.prototype.addLoadListener, arguments);
    };
    __ui_Image.prototype.__class__.addLoadListener.unbound_method = true;
    __ui_Image.prototype.addLoadListener.instance_method = true;
    __ui_Image.prototype.addMouseListener = function(listener) {
    this.mouseListeners.append(listener);
    };
    __ui_Image.prototype.__class__.addMouseListener = function() {
        return __ui_Image.prototype.addMouseListener.call.apply(__ui_Image.prototype.addMouseListener, arguments);
    };
    __ui_Image.prototype.__class__.addMouseListener.unbound_method = true;
    __ui_Image.prototype.addMouseListener.instance_method = true;
    __ui_Image.prototype.getUrl = function() {
    return DOM_getAttribute(this.getElement(), 'src');
    };
    __ui_Image.prototype.__class__.getUrl = function() {
        return __ui_Image.prototype.getUrl.call.apply(__ui_Image.prototype.getUrl, arguments);
    };
    __ui_Image.prototype.__class__.getUrl.unbound_method = true;
    __ui_Image.prototype.getUrl.instance_method = true;
    __ui_Image.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onClick) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if (((type == 'mousedown')) || ((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'mouseover')) || ((type == 'mouseout'))) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    }
    else if ((type == 'load')) {

        var __listener = this.loadListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onLoad(this);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'error')) {

        var __listener = this.loadListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onError(this);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_Image.prototype.__class__.onBrowserEvent = function() {
        return __ui_Image.prototype.onBrowserEvent.call.apply(__ui_Image.prototype.onBrowserEvent, arguments);
    };
    __ui_Image.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Image.prototype.onBrowserEvent.instance_method = true;
    __ui_Image.prototype.prefetch = function(url) {
    var img = DOM_createImg();
    DOM_setAttribute(img, 'src', url);
    ui_prefetchImages.__setitem__(url, img);
    };
    __ui_Image.prototype.__class__.prefetch = function() {
        return __ui_Image.prototype.prefetch.call.apply(__ui_Image.prototype.prefetch, arguments);
    };
    __ui_Image.prototype.__class__.prefetch.unbound_method = true;
    __ui_Image.prototype.prefetch.instance_method = true;
    __ui_Image.prototype.setUrl = function(url) {
    DOM_setAttribute(this.getElement(), 'src', url);
    };
    __ui_Image.prototype.__class__.setUrl = function() {
        return __ui_Image.prototype.setUrl.call.apply(__ui_Image.prototype.setUrl, arguments);
    };
    __ui_Image.prototype.__class__.setUrl.unbound_method = true;
    __ui_Image.prototype.setUrl.instance_method = true;
}
function __ui_FlowPanel() {
}
function ui_FlowPanel() {
    var instance = new __ui_FlowPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FlowPanel_initialize() {
    if(__ui_FlowPanel.__was_initialized__) return;
    __ui_FlowPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_FlowPanel, __ui_ComplexPanel);
    __ui_FlowPanel.prototype.__class__.__new__ = ui_FlowPanel;
    __ui_FlowPanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.setElement(DOM_createDiv());
    };
    __ui_FlowPanel.prototype.__class__.__init__ = function() {
        return __ui_FlowPanel.prototype.__init__.call.apply(__ui_FlowPanel.prototype.__init__, arguments);
    };
    __ui_FlowPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_FlowPanel.prototype.__init__.instance_method = true;
    __ui_FlowPanel.prototype.add = function(w) {
    __ui_ComplexPanel.prototype.__class__.add(this, w, this.getElement());
    };
    __ui_FlowPanel.prototype.__class__.add = function() {
        return __ui_FlowPanel.prototype.add.call.apply(__ui_FlowPanel.prototype.add, arguments);
    };
    __ui_FlowPanel.prototype.__class__.add.unbound_method = true;
    __ui_FlowPanel.prototype.add.instance_method = true;
    __ui_FlowPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_FlowPanel.prototype.__class__.getWidget = function() {
        return __ui_FlowPanel.prototype.getWidget.call.apply(__ui_FlowPanel.prototype.getWidget, arguments);
    };
    __ui_FlowPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_FlowPanel.prototype.getWidget.instance_method = true;
    __ui_FlowPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_FlowPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_FlowPanel.prototype.getWidgetCount.call.apply(__ui_FlowPanel.prototype.getWidgetCount, arguments);
    };
    __ui_FlowPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_FlowPanel.prototype.getWidgetCount.instance_method = true;
    __ui_FlowPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_FlowPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_FlowPanel.prototype.getWidgetIndex.call.apply(__ui_FlowPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_FlowPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_FlowPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_FlowPanel.prototype.remove = function(index) {
    if (pyjslib_isNumber(index)) {
    var index = this.getWidget(index);
    }
    return __ui_ComplexPanel.prototype.__class__.remove(this, index);
    };
    __ui_FlowPanel.prototype.__class__.remove = function() {
        return __ui_FlowPanel.prototype.remove.call.apply(__ui_FlowPanel.prototype.remove, arguments);
    };
    __ui_FlowPanel.prototype.__class__.remove.unbound_method = true;
    __ui_FlowPanel.prototype.remove.instance_method = true;
}
    var ui_HTMLPanel_sUid = 0;
function __ui_HTMLPanel() {
}
function ui_HTMLPanel(html) {
    var instance = new __ui_HTMLPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HTMLPanel_initialize() {
    if(__ui_HTMLPanel.__was_initialized__) return;
    __ui_HTMLPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_HTMLPanel, __ui_ComplexPanel);
    __ui_HTMLPanel.prototype.__class__.__new__ = ui_HTMLPanel;
    __ui_HTMLPanel.prototype.__init__ = function(html) {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.setElement(DOM_createDiv());
    DOM_setInnerHTML(this.getElement(), html);
    };
    __ui_HTMLPanel.prototype.__class__.__init__ = function() {
        return __ui_HTMLPanel.prototype.__init__.call.apply(__ui_HTMLPanel.prototype.__init__, arguments);
    };
    __ui_HTMLPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_HTMLPanel.prototype.__init__.instance_method = true;
    __ui_HTMLPanel.prototype.add = function(widget, id) {
    var element = this.getElementById(this.getElement(), id);
    if ((element == null)) {
    return;
    }
    __ui_ComplexPanel.prototype.__class__.add(this, widget, element);
    };
    __ui_HTMLPanel.prototype.__class__.add = function() {
        return __ui_HTMLPanel.prototype.add.call.apply(__ui_HTMLPanel.prototype.add, arguments);
    };
    __ui_HTMLPanel.prototype.__class__.add.unbound_method = true;
    __ui_HTMLPanel.prototype.add.instance_method = true;
    __ui_HTMLPanel.prototype.createUniqueId = function() {
    ui_HTMLPanel_sUid += 1;
    return  ( 'HTMLPanel_' + ui_HTMLPanel_sUid ) ;
    };
    __ui_HTMLPanel.prototype.__class__.createUniqueId = function() {
        return __ui_HTMLPanel.prototype.createUniqueId.call.apply(__ui_HTMLPanel.prototype.createUniqueId, arguments);
    };
    __ui_HTMLPanel.prototype.__class__.createUniqueId.unbound_method = true;
    __ui_HTMLPanel.prototype.createUniqueId.instance_method = true;
    __ui_HTMLPanel.prototype.getElementById = function(element, id) {
    var element_id = DOM_getAttribute(element, 'id');
    if (((element_id != null)) && ((element_id == id))) {
    return element;
    }
    var child = DOM_getFirstChild(element);
    while ((child != null)) {
    var ret = this.getElementById(child, id);
    if ((ret != null)) {
    return ret;
    }
    var child = DOM_getNextSibling(child);
    }
    return;
    };
    __ui_HTMLPanel.prototype.__class__.getElementById = function() {
        return __ui_HTMLPanel.prototype.getElementById.call.apply(__ui_HTMLPanel.prototype.getElementById, arguments);
    };
    __ui_HTMLPanel.prototype.__class__.getElementById.unbound_method = true;
    __ui_HTMLPanel.prototype.getElementById.instance_method = true;
}
function __ui_DeckPanel() {
}
function ui_DeckPanel() {
    var instance = new __ui_DeckPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DeckPanel_initialize() {
    if(__ui_DeckPanel.__was_initialized__) return;
    __ui_DeckPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_DeckPanel, __ui_ComplexPanel);
    __ui_DeckPanel.prototype.__class__.__new__ = ui_DeckPanel;
    __ui_DeckPanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.visibleWidget = null;
    this.setElement(DOM_createDiv());
    };
    __ui_DeckPanel.prototype.__class__.__init__ = function() {
        return __ui_DeckPanel.prototype.__init__.call.apply(__ui_DeckPanel.prototype.__init__, arguments);
    };
    __ui_DeckPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_DeckPanel.prototype.__init__.instance_method = true;
    __ui_DeckPanel.prototype.add = function(widget) {
    this.insert(widget, this.getWidgetCount());
    };
    __ui_DeckPanel.prototype.__class__.add = function() {
        return __ui_DeckPanel.prototype.add.call.apply(__ui_DeckPanel.prototype.add, arguments);
    };
    __ui_DeckPanel.prototype.__class__.add.unbound_method = true;
    __ui_DeckPanel.prototype.add.instance_method = true;
    __ui_DeckPanel.prototype.getVisibleWidget = function() {
    return this.getWidgetIndex(this.visibleWidget);
    };
    __ui_DeckPanel.prototype.__class__.getVisibleWidget = function() {
        return __ui_DeckPanel.prototype.getVisibleWidget.call.apply(__ui_DeckPanel.prototype.getVisibleWidget, arguments);
    };
    __ui_DeckPanel.prototype.__class__.getVisibleWidget.unbound_method = true;
    __ui_DeckPanel.prototype.getVisibleWidget.instance_method = true;
    __ui_DeckPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_DeckPanel.prototype.__class__.getWidget = function() {
        return __ui_DeckPanel.prototype.getWidget.call.apply(__ui_DeckPanel.prototype.getWidget, arguments);
    };
    __ui_DeckPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_DeckPanel.prototype.getWidget.instance_method = true;
    __ui_DeckPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_DeckPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_DeckPanel.prototype.getWidgetCount.call.apply(__ui_DeckPanel.prototype.getWidgetCount, arguments);
    };
    __ui_DeckPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_DeckPanel.prototype.getWidgetCount.instance_method = true;
    __ui_DeckPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_DeckPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_DeckPanel.prototype.getWidgetIndex.call.apply(__ui_DeckPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_DeckPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_DeckPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_DeckPanel.prototype.insert = function(widget, beforeIndex) {
    if (((this.beforeIndex < 0)) || ((this.beforeIndex > this.getWidgetCount()))) {
    return;
    }
    __ui_ComplexPanel.prototype.__class__.insert(this, widget, this.getElement(), beforeIndex);
    var child = widget.getElement();
    DOM_setStyleAttribute(child, 'width', '100%');
    DOM_setStyleAttribute(child, 'height', '100%');
    widget.setVisible(false);
    };
    __ui_DeckPanel.prototype.__class__.insert = function() {
        return __ui_DeckPanel.prototype.insert.call.apply(__ui_DeckPanel.prototype.insert, arguments);
    };
    __ui_DeckPanel.prototype.__class__.insert.unbound_method = true;
    __ui_DeckPanel.prototype.insert.instance_method = true;
    __ui_DeckPanel.prototype.remove = function(widget) {
    if (pyjslib_isNumber(widget)) {
    var widget = this.getWidget(widget);
    }
    if (!(__ui_ComplexPanel.prototype.__class__.remove(this, widget))) {
    return false;
    }
    if ((this.visibleWidget == widget)) {
    this.visibleWidget = null;
    }
    return true;
    };
    __ui_DeckPanel.prototype.__class__.remove = function() {
        return __ui_DeckPanel.prototype.remove.call.apply(__ui_DeckPanel.prototype.remove, arguments);
    };
    __ui_DeckPanel.prototype.__class__.remove.unbound_method = true;
    __ui_DeckPanel.prototype.remove.instance_method = true;
    __ui_DeckPanel.prototype.showWidget = function(index) {
    this.checkIndex(index);
    if ((this.visibleWidget != null)) {
    this.visibleWidget.setVisible(false);
    }
    this.visibleWidget = this.getWidget(index);
    this.visibleWidget.setVisible(true);
    };
    __ui_DeckPanel.prototype.__class__.showWidget = function() {
        return __ui_DeckPanel.prototype.showWidget.call.apply(__ui_DeckPanel.prototype.showWidget, arguments);
    };
    __ui_DeckPanel.prototype.__class__.showWidget.unbound_method = true;
    __ui_DeckPanel.prototype.showWidget.instance_method = true;
    __ui_DeckPanel.prototype.checkIndex = function(index) {
    if (((index < 0)) || ((index >= this.getWidgetCount()))) {
    }
    };
    __ui_DeckPanel.prototype.__class__.checkIndex = function() {
        return __ui_DeckPanel.prototype.checkIndex.call.apply(__ui_DeckPanel.prototype.checkIndex, arguments);
    };
    __ui_DeckPanel.prototype.__class__.checkIndex.unbound_method = true;
    __ui_DeckPanel.prototype.checkIndex.instance_method = true;
}
function __ui_SimplePanel() {
}
function ui_SimplePanel(element) {
    if (typeof element == 'undefined') element=null;
    var instance = new __ui_SimplePanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_SimplePanel.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
function __ui_SimplePanel_initialize() {
    if(__ui_SimplePanel.__was_initialized__) return;
    __ui_SimplePanel.__was_initialized__ = true;
    if(!__ui_Panel.__was_initialized__)
        __ui_Panel_initialize();
    pyjs_extend(__ui_SimplePanel, __ui_Panel);
    __ui_SimplePanel.prototype.__class__.__new__ = ui_SimplePanel;
    __ui_SimplePanel.prototype.__init__ = function(element) {
    if (typeof element == 'undefined') element=null;
    __ui_Panel.prototype.__class__.__init__(this);
    if ((element == null)) {
    var element = DOM_createDiv();
    }
    this.setElement(element);
    };
__ui_SimplePanel.prototype.__init__.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
    __ui_SimplePanel.prototype.__class__.__init__ = function() {
        return __ui_SimplePanel.prototype.__init__.call.apply(__ui_SimplePanel.prototype.__init__, arguments);
    };
    __ui_SimplePanel.prototype.__class__.__init__.unbound_method = true;
    __ui_SimplePanel.prototype.__init__.instance_method = true;
    __ui_SimplePanel.prototype.__class__.__init__.parse_kwargs = __ui_SimplePanel.prototype.__init__.parse_kwargs;
    __ui_SimplePanel.prototype.add = function(widget) {
    if ((this.getWidget() != null)) {
    console.error('SimplePanel can only contain one child widget');
    return;
    }
    this.setWidget(widget);
    };
    __ui_SimplePanel.prototype.__class__.add = function() {
        return __ui_SimplePanel.prototype.add.call.apply(__ui_SimplePanel.prototype.add, arguments);
    };
    __ui_SimplePanel.prototype.__class__.add.unbound_method = true;
    __ui_SimplePanel.prototype.add.instance_method = true;
    __ui_SimplePanel.prototype.getWidget = function() {
    if (pyjslib_len(this.children)) {
    return this.children.__getitem__(0);
    }
    return;
    };
    __ui_SimplePanel.prototype.__class__.getWidget = function() {
        return __ui_SimplePanel.prototype.getWidget.call.apply(__ui_SimplePanel.prototype.getWidget, arguments);
    };
    __ui_SimplePanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_SimplePanel.prototype.getWidget.instance_method = true;
    __ui_SimplePanel.prototype.remove = function(widget) {
    if ((this.getWidget() != widget)) {
    return false;
    }
    this.disown(widget);
    this.children.__delitem__(0);
    return true;
    };
    __ui_SimplePanel.prototype.__class__.remove = function() {
        return __ui_SimplePanel.prototype.remove.call.apply(__ui_SimplePanel.prototype.remove, arguments);
    };
    __ui_SimplePanel.prototype.__class__.remove.unbound_method = true;
    __ui_SimplePanel.prototype.remove.instance_method = true;
    __ui_SimplePanel.prototype.getContainerElement = function() {
    return this.getElement();
    };
    __ui_SimplePanel.prototype.__class__.getContainerElement = function() {
        return __ui_SimplePanel.prototype.getContainerElement.call.apply(__ui_SimplePanel.prototype.getContainerElement, arguments);
    };
    __ui_SimplePanel.prototype.__class__.getContainerElement.unbound_method = true;
    __ui_SimplePanel.prototype.getContainerElement.instance_method = true;
    __ui_SimplePanel.prototype.setWidget = function(widget) {
    if ((this.getWidget() == widget)) {
    return;
    }
    if ((this.getWidget() != null)) {
    this.remove(this.getWidget());
    }
    if ((widget != null)) {
    this.adopt(widget, this.getContainerElement());
    this.children.__setitem__(0, widget);
    }
    };
    __ui_SimplePanel.prototype.__class__.setWidget = function() {
        return __ui_SimplePanel.prototype.setWidget.call.apply(__ui_SimplePanel.prototype.setWidget, arguments);
    };
    __ui_SimplePanel.prototype.__class__.setWidget.unbound_method = true;
    __ui_SimplePanel.prototype.setWidget.instance_method = true;
}
function __ui_ScrollPanel() {
}
function ui_ScrollPanel(child) {
    if (typeof child == 'undefined') child=null;
    var instance = new __ui_ScrollPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_ScrollPanel.parse_kwargs = function ( __kwargs, child ) {
    if (typeof child == 'undefined')
        child=__kwargs.child;
    var __r = [child];
    return __r;
};
function __ui_ScrollPanel_initialize() {
    if(__ui_ScrollPanel.__was_initialized__) return;
    __ui_ScrollPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_ScrollPanel, __ui_SimplePanel);
    __ui_ScrollPanel.prototype.__class__.__new__ = ui_ScrollPanel;
    __ui_ScrollPanel.prototype.__init__ = function(child) {
    if (typeof child == 'undefined') child=null;
    __ui_SimplePanel.prototype.__class__.__init__(this);
    this.scrollListeners = new pyjslib_List([]);
    this.setAlwaysShowScrollBars(false);
    this.sinkEvents(__ui_Event.prototype.__class__.ONSCROLL);
    if ((child != null)) {
    this.setWidget(child);
    }
    };
__ui_ScrollPanel.prototype.__init__.parse_kwargs = function ( __kwargs, child ) {
    if (typeof child == 'undefined')
        child=__kwargs.child;
    var __r = [child];
    return __r;
};
    __ui_ScrollPanel.prototype.__class__.__init__ = function() {
        return __ui_ScrollPanel.prototype.__init__.call.apply(__ui_ScrollPanel.prototype.__init__, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_ScrollPanel.prototype.__init__.instance_method = true;
    __ui_ScrollPanel.prototype.__class__.__init__.parse_kwargs = __ui_ScrollPanel.prototype.__init__.parse_kwargs;
    __ui_ScrollPanel.prototype.addScrollListener = function(listener) {
    this.scrollListeners.append(listener);
    };
    __ui_ScrollPanel.prototype.__class__.addScrollListener = function() {
        return __ui_ScrollPanel.prototype.addScrollListener.call.apply(__ui_ScrollPanel.prototype.addScrollListener, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.addScrollListener.unbound_method = true;
    __ui_ScrollPanel.prototype.addScrollListener.instance_method = true;
    __ui_ScrollPanel.prototype.ensureVisible = function(item) {
    var scroll = this.getElement();
    var element = item.getElement();
    this.ensureVisibleImpl(scroll, element);
    };
    __ui_ScrollPanel.prototype.__class__.ensureVisible = function() {
        return __ui_ScrollPanel.prototype.ensureVisible.call.apply(__ui_ScrollPanel.prototype.ensureVisible, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.ensureVisible.unbound_method = true;
    __ui_ScrollPanel.prototype.ensureVisible.instance_method = true;
    __ui_ScrollPanel.prototype.getScrollPosition = function() {
    return DOM_getIntAttribute(this.getElement(), 'scrollTop');
    };
    __ui_ScrollPanel.prototype.__class__.getScrollPosition = function() {
        return __ui_ScrollPanel.prototype.getScrollPosition.call.apply(__ui_ScrollPanel.prototype.getScrollPosition, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.getScrollPosition.unbound_method = true;
    __ui_ScrollPanel.prototype.getScrollPosition.instance_method = true;
    __ui_ScrollPanel.prototype.getHorizontalScrollPosition = function() {
    return DOM_getIntAttribute(this.getElement(), 'scrollLeft');
    };
    __ui_ScrollPanel.prototype.__class__.getHorizontalScrollPosition = function() {
        return __ui_ScrollPanel.prototype.getHorizontalScrollPosition.call.apply(__ui_ScrollPanel.prototype.getHorizontalScrollPosition, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.getHorizontalScrollPosition.unbound_method = true;
    __ui_ScrollPanel.prototype.getHorizontalScrollPosition.instance_method = true;
    __ui_ScrollPanel.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'scroll')) {

        var __listener = this.scrollListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onScroll(this, this.getHorizontalScrollPosition(), this.getScrollPosition());

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_ScrollPanel.prototype.__class__.onBrowserEvent = function() {
        return __ui_ScrollPanel.prototype.onBrowserEvent.call.apply(__ui_ScrollPanel.prototype.onBrowserEvent, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_ScrollPanel.prototype.onBrowserEvent.instance_method = true;
    __ui_ScrollPanel.prototype.removeScrollListener = function(listener) {
    this.scrollListeners.remove(listener);
    };
    __ui_ScrollPanel.prototype.__class__.removeScrollListener = function() {
        return __ui_ScrollPanel.prototype.removeScrollListener.call.apply(__ui_ScrollPanel.prototype.removeScrollListener, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.removeScrollListener.unbound_method = true;
    __ui_ScrollPanel.prototype.removeScrollListener.instance_method = true;
    __ui_ScrollPanel.prototype.setAlwaysShowScrollBars = function(alwaysShow) {
    if (alwaysShow) {
    var style = 'scroll';
    }
    else {
    var style = 'auto';
    }
    DOM_setStyleAttribute(this.getElement(), 'overflow', style);
    };
    __ui_ScrollPanel.prototype.__class__.setAlwaysShowScrollBars = function() {
        return __ui_ScrollPanel.prototype.setAlwaysShowScrollBars.call.apply(__ui_ScrollPanel.prototype.setAlwaysShowScrollBars, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.setAlwaysShowScrollBars.unbound_method = true;
    __ui_ScrollPanel.prototype.setAlwaysShowScrollBars.instance_method = true;
    __ui_ScrollPanel.prototype.setScrollPosition = function(position) {
    DOM_setIntAttribute(this.getElement(), 'scrollTop', position);
    };
    __ui_ScrollPanel.prototype.__class__.setScrollPosition = function() {
        return __ui_ScrollPanel.prototype.setScrollPosition.call.apply(__ui_ScrollPanel.prototype.setScrollPosition, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.setScrollPosition.unbound_method = true;
    __ui_ScrollPanel.prototype.setScrollPosition.instance_method = true;
    __ui_ScrollPanel.prototype.setHorizontalScrollPosition = function(position) {
    DOM_setIntAttribute(this.getElement(), 'scrollLeft', position);
    };
    __ui_ScrollPanel.prototype.__class__.setHorizontalScrollPosition = function() {
        return __ui_ScrollPanel.prototype.setHorizontalScrollPosition.call.apply(__ui_ScrollPanel.prototype.setHorizontalScrollPosition, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.setHorizontalScrollPosition.unbound_method = true;
    __ui_ScrollPanel.prototype.setHorizontalScrollPosition.instance_method = true;
    __ui_ScrollPanel.prototype.ensureVisibleImpl = function(scroll, e) {

        if (!e) return;

        var item = e;
        var realOffset = 0;
        while (item && (item != scroll)) {
            realOffset += item.offsetTop;
            item = item.offsetParent;
            }

        scroll.scrollTop = realOffset - scroll.offsetHeight / 2;
        
    };
    __ui_ScrollPanel.prototype.__class__.ensureVisibleImpl = function() {
        return __ui_ScrollPanel.prototype.ensureVisibleImpl.call.apply(__ui_ScrollPanel.prototype.ensureVisibleImpl, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.ensureVisibleImpl.unbound_method = true;
    __ui_ScrollPanel.prototype.ensureVisibleImpl.instance_method = true;
}
function __ui_PopupPanel() {
}
function ui_PopupPanel(autoHide, modal) {
    if (typeof autoHide == 'undefined') autoHide=false;
    if (typeof modal == 'undefined') modal=true;
    var instance = new __ui_PopupPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_PopupPanel.parse_kwargs = function ( __kwargs, autoHide, modal ) {
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    if (typeof modal == 'undefined')
        modal=__kwargs.modal;
    var __r = [autoHide, modal];
    return __r;
};
function __ui_PopupPanel_initialize() {
    if(__ui_PopupPanel.__was_initialized__) return;
    __ui_PopupPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_PopupPanel, __ui_SimplePanel);
    __ui_PopupPanel.prototype.__class__.__new__ = ui_PopupPanel;
    __ui_PopupPanel.prototype.__init__ = function(autoHide, modal) {
    if (typeof autoHide == 'undefined') autoHide=false;
    if (typeof modal == 'undefined') modal=true;
    this.popupListeners = new pyjslib_List([]);
    this.showing = false;
    this.autoHide = false;
    this.modal = modal;
    __ui_SimplePanel.prototype.__class__.__init__(this, this.createElement());
    DOM_setStyleAttribute(this.getElement(), 'position', 'absolute');
    if (autoHide) {
    this.autoHide = autoHide;
    }
    };
__ui_PopupPanel.prototype.__init__.parse_kwargs = function ( __kwargs, autoHide, modal ) {
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    if (typeof modal == 'undefined')
        modal=__kwargs.modal;
    var __r = [autoHide, modal];
    return __r;
};
    __ui_PopupPanel.prototype.__class__.__init__ = function() {
        return __ui_PopupPanel.prototype.__init__.call.apply(__ui_PopupPanel.prototype.__init__, arguments);
    };
    __ui_PopupPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_PopupPanel.prototype.__init__.instance_method = true;
    __ui_PopupPanel.prototype.__class__.__init__.parse_kwargs = __ui_PopupPanel.prototype.__init__.parse_kwargs;
    __ui_PopupPanel.prototype.addPopupListener = function(listener) {
    this.popupListeners.append(listener);
    };
    __ui_PopupPanel.prototype.__class__.addPopupListener = function() {
        return __ui_PopupPanel.prototype.addPopupListener.call.apply(__ui_PopupPanel.prototype.addPopupListener, arguments);
    };
    __ui_PopupPanel.prototype.__class__.addPopupListener.unbound_method = true;
    __ui_PopupPanel.prototype.addPopupListener.instance_method = true;
    __ui_PopupPanel.prototype.getPopupLeft = function() {
    return DOM_getIntAttribute(this.getElement(), 'offsetLeft');
    };
    __ui_PopupPanel.prototype.__class__.getPopupLeft = function() {
        return __ui_PopupPanel.prototype.getPopupLeft.call.apply(__ui_PopupPanel.prototype.getPopupLeft, arguments);
    };
    __ui_PopupPanel.prototype.__class__.getPopupLeft.unbound_method = true;
    __ui_PopupPanel.prototype.getPopupLeft.instance_method = true;
    __ui_PopupPanel.prototype.getPopupTop = function() {
    return DOM_getIntAttribute(this.getElement(), 'offsetTop');
    };
    __ui_PopupPanel.prototype.__class__.getPopupTop = function() {
        return __ui_PopupPanel.prototype.getPopupTop.call.apply(__ui_PopupPanel.prototype.getPopupTop, arguments);
    };
    __ui_PopupPanel.prototype.__class__.getPopupTop.unbound_method = true;
    __ui_PopupPanel.prototype.getPopupTop.instance_method = true;
    __ui_PopupPanel.prototype.createElement = function() {
    return DOM_createDiv();
    };
    __ui_PopupPanel.prototype.__class__.createElement = function() {
        return __ui_PopupPanel.prototype.createElement.call.apply(__ui_PopupPanel.prototype.createElement, arguments);
    };
    __ui_PopupPanel.prototype.__class__.createElement.unbound_method = true;
    __ui_PopupPanel.prototype.createElement.instance_method = true;
    __ui_PopupPanel.prototype.hide = function(autoClosed) {
    if (typeof autoClosed == 'undefined') autoClosed=false;
    if (!(this.showing)) {
    return;
    }
    this.showing = false;
    DOM_removeEventPreview(this);
    ui_RootPanel().get().remove(this);
    this.onHideImpl(this.getElement());

        var __listener = this.popupListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onPopupClosed) {
    listener.onPopupClosed(this, autoClosed);
    }
    else {
    listener(this, autoClosed);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
__ui_PopupPanel.prototype.hide.parse_kwargs = function ( __kwargs, autoClosed ) {
    if (typeof autoClosed == 'undefined')
        autoClosed=__kwargs.autoClosed;
    var __r = [autoClosed];
    return __r;
};
    __ui_PopupPanel.prototype.__class__.hide = function() {
        return __ui_PopupPanel.prototype.hide.call.apply(__ui_PopupPanel.prototype.hide, arguments);
    };
    __ui_PopupPanel.prototype.__class__.hide.unbound_method = true;
    __ui_PopupPanel.prototype.hide.instance_method = true;
    __ui_PopupPanel.prototype.__class__.hide.parse_kwargs = __ui_PopupPanel.prototype.hide.parse_kwargs;
    __ui_PopupPanel.prototype.isModal = function() {
    return this.modal;
    };
    __ui_PopupPanel.prototype.__class__.isModal = function() {
        return __ui_PopupPanel.prototype.isModal.call.apply(__ui_PopupPanel.prototype.isModal, arguments);
    };
    __ui_PopupPanel.prototype.__class__.isModal.unbound_method = true;
    __ui_PopupPanel.prototype.isModal.instance_method = true;
    __ui_PopupPanel.prototype.onEventPreview = function(event) {
    var target = DOM_eventGetTarget(event);
    var event_targets_popup = (target) && (DOM_isOrHasChild(this.getElement(), target));
    var type = DOM_eventGetType(event);
    if ((type == 'keydown')) {
    return (this.onKeyDownPreview(DOM_eventGetKeyCode(event), __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers(this, event))) && ((event_targets_popup) || (!(this.modal)));
    }
    else if ((type == 'keyup')) {
    return (this.onKeyUpPreview(DOM_eventGetKeyCode(event), __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers(this, event))) && ((event_targets_popup) || (!(this.modal)));
    }
    else if ((type == 'keypress')) {
    return (this.onKeyPressPreview(DOM_eventGetKeyCode(event), __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers(this, event))) && ((event_targets_popup) || (!(this.modal)));
    }
    else if ((type == 'mousedown')) {
    if ((DOM_getCaptureElement() != null)) {
    return true;
    }
    if ((!(event_targets_popup)) && (this.autoHide)) {
    this.hide(true);
    return true;
    }
    }
    else if (((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'click')) || ((type == 'dblclick'))) {
    if ((DOM_getCaptureElement() != null)) {
    return true;
    }
    }
    return (!(this.modal)) || (event_targets_popup);
    };
    __ui_PopupPanel.prototype.__class__.onEventPreview = function() {
        return __ui_PopupPanel.prototype.onEventPreview.call.apply(__ui_PopupPanel.prototype.onEventPreview, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onEventPreview.unbound_method = true;
    __ui_PopupPanel.prototype.onEventPreview.instance_method = true;
    __ui_PopupPanel.prototype.onKeyDownPreview = function(key, modifiers) {
    return true;
    };
    __ui_PopupPanel.prototype.__class__.onKeyDownPreview = function() {
        return __ui_PopupPanel.prototype.onKeyDownPreview.call.apply(__ui_PopupPanel.prototype.onKeyDownPreview, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onKeyDownPreview.unbound_method = true;
    __ui_PopupPanel.prototype.onKeyDownPreview.instance_method = true;
    __ui_PopupPanel.prototype.onKeyPressPreview = function(key, modifiers) {
    return true;
    };
    __ui_PopupPanel.prototype.__class__.onKeyPressPreview = function() {
        return __ui_PopupPanel.prototype.onKeyPressPreview.call.apply(__ui_PopupPanel.prototype.onKeyPressPreview, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onKeyPressPreview.unbound_method = true;
    __ui_PopupPanel.prototype.onKeyPressPreview.instance_method = true;
    __ui_PopupPanel.prototype.onKeyUpPreview = function(key, modifiers) {
    return true;
    };
    __ui_PopupPanel.prototype.__class__.onKeyUpPreview = function() {
        return __ui_PopupPanel.prototype.onKeyUpPreview.call.apply(__ui_PopupPanel.prototype.onKeyUpPreview, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onKeyUpPreview.unbound_method = true;
    __ui_PopupPanel.prototype.onKeyUpPreview.instance_method = true;
    __ui_PopupPanel.prototype.onHideImpl = function(popup) {
    };
    __ui_PopupPanel.prototype.__class__.onHideImpl = function() {
        return __ui_PopupPanel.prototype.onHideImpl.call.apply(__ui_PopupPanel.prototype.onHideImpl, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onHideImpl.unbound_method = true;
    __ui_PopupPanel.prototype.onHideImpl.instance_method = true;
    __ui_PopupPanel.prototype.onShowImpl = function(popup) {
    };
    __ui_PopupPanel.prototype.__class__.onShowImpl = function() {
        return __ui_PopupPanel.prototype.onShowImpl.call.apply(__ui_PopupPanel.prototype.onShowImpl, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onShowImpl.unbound_method = true;
    __ui_PopupPanel.prototype.onShowImpl.instance_method = true;
    __ui_PopupPanel.prototype.removePopupListener = function(listener) {
    this.popupListeners.remove(listener);
    };
    __ui_PopupPanel.prototype.__class__.removePopupListener = function() {
        return __ui_PopupPanel.prototype.removePopupListener.call.apply(__ui_PopupPanel.prototype.removePopupListener, arguments);
    };
    __ui_PopupPanel.prototype.__class__.removePopupListener.unbound_method = true;
    __ui_PopupPanel.prototype.removePopupListener.instance_method = true;
    __ui_PopupPanel.prototype.setPopupPosition = function(left, top) {
    if ((left < 0)) {
    var left = 0;
    }
    if ((top < 0)) {
    var top = 0;
    }
    var element = this.getElement();
    DOM_setStyleAttribute(element, 'left',  ( left + 'px' ) );
    DOM_setStyleAttribute(element, 'top',  ( top + 'px' ) );
    };
    __ui_PopupPanel.prototype.__class__.setPopupPosition = function() {
        return __ui_PopupPanel.prototype.setPopupPosition.call.apply(__ui_PopupPanel.prototype.setPopupPosition, arguments);
    };
    __ui_PopupPanel.prototype.__class__.setPopupPosition.unbound_method = true;
    __ui_PopupPanel.prototype.setPopupPosition.instance_method = true;
    __ui_PopupPanel.prototype.show = function() {
    if (this.showing) {
    return;
    }
    this.showing = true;
    DOM_addEventPreview(this);
    ui_RootPanel().get().add(this);
    this.onShowImpl(this.getElement());
    };
    __ui_PopupPanel.prototype.__class__.show = function() {
        return __ui_PopupPanel.prototype.show.call.apply(__ui_PopupPanel.prototype.show, arguments);
    };
    __ui_PopupPanel.prototype.__class__.show.unbound_method = true;
    __ui_PopupPanel.prototype.show.instance_method = true;
}
function __ui_MenuItem() {
}
function ui_MenuItem(text, asHTML, subMenu) {
    if (typeof subMenu == 'undefined') subMenu=null;
    var instance = new __ui_MenuItem();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_MenuItem.parse_kwargs = function ( __kwargs, text, asHTML, subMenu ) {
    if (typeof subMenu == 'undefined')
        subMenu=__kwargs.subMenu;
    var __r = [text, asHTML, subMenu];
    return __r;
};
function __ui_MenuItem_initialize() {
    if(__ui_MenuItem.__was_initialized__) return;
    __ui_MenuItem.__was_initialized__ = true;
    if(!__ui_UIObject.__was_initialized__)
        __ui_UIObject_initialize();
    pyjs_extend(__ui_MenuItem, __ui_UIObject);
    __ui_MenuItem.prototype.__class__.__new__ = ui_MenuItem;
    __ui_MenuItem.prototype.__init__ = function(text, asHTML, subMenu) {
    if (typeof subMenu == 'undefined') subMenu=null;
    var cmd = null;
    if ((subMenu == null)) {
    if (pyjslib_hasattr(asHTML, 'execute')) {
    var cmd = asHTML;
    var asHTML = false;
    }
    else if (pyjslib_hasattr(asHTML, 'onShow')) {
    var subMenu = asHTML;
    var asHTML = false;
    }
    }
    else if (pyjslib_hasattr(subMenu, 'execute')) {
    var cmd = subMenu;
    var subMenu = null;
    }
    this.command = null;
    this.parentMenu = null;
    this.subMenu = null;
    this.setElement(DOM_createTD());
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.ONMOUSEOVER | __ui_Event.prototype.__class__.ONMOUSEOUT));
    this.setSelectionStyle(false);
    if (asHTML) {
    this.setHTML(text);
    }
    else {
    this.setText(text);
    }
    this.setStyleName('gwt-MenuItem');
    if (cmd) {
    this.setCommand(cmd);
    }
    if (subMenu) {
    this.setSubMenu(subMenu);
    }
    };
__ui_MenuItem.prototype.__init__.parse_kwargs = function ( __kwargs, text, asHTML, subMenu ) {
    if (typeof subMenu == 'undefined')
        subMenu=__kwargs.subMenu;
    var __r = [text, asHTML, subMenu];
    return __r;
};
    __ui_MenuItem.prototype.__class__.__init__ = function() {
        return __ui_MenuItem.prototype.__init__.call.apply(__ui_MenuItem.prototype.__init__, arguments);
    };
    __ui_MenuItem.prototype.__class__.__init__.unbound_method = true;
    __ui_MenuItem.prototype.__init__.instance_method = true;
    __ui_MenuItem.prototype.__class__.__init__.parse_kwargs = __ui_MenuItem.prototype.__init__.parse_kwargs;
    __ui_MenuItem.prototype.getCommand = function() {
    return this.command;
    };
    __ui_MenuItem.prototype.__class__.getCommand = function() {
        return __ui_MenuItem.prototype.getCommand.call.apply(__ui_MenuItem.prototype.getCommand, arguments);
    };
    __ui_MenuItem.prototype.__class__.getCommand.unbound_method = true;
    __ui_MenuItem.prototype.getCommand.instance_method = true;
    __ui_MenuItem.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.getElement());
    };
    __ui_MenuItem.prototype.__class__.getHTML = function() {
        return __ui_MenuItem.prototype.getHTML.call.apply(__ui_MenuItem.prototype.getHTML, arguments);
    };
    __ui_MenuItem.prototype.__class__.getHTML.unbound_method = true;
    __ui_MenuItem.prototype.getHTML.instance_method = true;
    __ui_MenuItem.prototype.getParentMenu = function() {
    return this.parentMenu;
    };
    __ui_MenuItem.prototype.__class__.getParentMenu = function() {
        return __ui_MenuItem.prototype.getParentMenu.call.apply(__ui_MenuItem.prototype.getParentMenu, arguments);
    };
    __ui_MenuItem.prototype.__class__.getParentMenu.unbound_method = true;
    __ui_MenuItem.prototype.getParentMenu.instance_method = true;
    __ui_MenuItem.prototype.getSubMenu = function() {
    return this.subMenu;
    };
    __ui_MenuItem.prototype.__class__.getSubMenu = function() {
        return __ui_MenuItem.prototype.getSubMenu.call.apply(__ui_MenuItem.prototype.getSubMenu, arguments);
    };
    __ui_MenuItem.prototype.__class__.getSubMenu.unbound_method = true;
    __ui_MenuItem.prototype.getSubMenu.instance_method = true;
    __ui_MenuItem.prototype.getText = function() {
    return DOM_getInnerText(this.getElement());
    };
    __ui_MenuItem.prototype.__class__.getText = function() {
        return __ui_MenuItem.prototype.getText.call.apply(__ui_MenuItem.prototype.getText, arguments);
    };
    __ui_MenuItem.prototype.__class__.getText.unbound_method = true;
    __ui_MenuItem.prototype.getText.instance_method = true;
    __ui_MenuItem.prototype.setCommand = function(cmd) {
    this.command = cmd;
    };
    __ui_MenuItem.prototype.__class__.setCommand = function() {
        return __ui_MenuItem.prototype.setCommand.call.apply(__ui_MenuItem.prototype.setCommand, arguments);
    };
    __ui_MenuItem.prototype.__class__.setCommand.unbound_method = true;
    __ui_MenuItem.prototype.setCommand.instance_method = true;
    __ui_MenuItem.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.getElement(), html);
    };
    __ui_MenuItem.prototype.__class__.setHTML = function() {
        return __ui_MenuItem.prototype.setHTML.call.apply(__ui_MenuItem.prototype.setHTML, arguments);
    };
    __ui_MenuItem.prototype.__class__.setHTML.unbound_method = true;
    __ui_MenuItem.prototype.setHTML.instance_method = true;
    __ui_MenuItem.prototype.setSubMenu = function(subMenu) {
    this.subMenu = subMenu;
    };
    __ui_MenuItem.prototype.__class__.setSubMenu = function() {
        return __ui_MenuItem.prototype.setSubMenu.call.apply(__ui_MenuItem.prototype.setSubMenu, arguments);
    };
    __ui_MenuItem.prototype.__class__.setSubMenu.unbound_method = true;
    __ui_MenuItem.prototype.setSubMenu.instance_method = true;
    __ui_MenuItem.prototype.setText = function(text) {
    DOM_setInnerText(this.getElement(), text);
    };
    __ui_MenuItem.prototype.__class__.setText = function() {
        return __ui_MenuItem.prototype.setText.call.apply(__ui_MenuItem.prototype.setText, arguments);
    };
    __ui_MenuItem.prototype.__class__.setText.unbound_method = true;
    __ui_MenuItem.prototype.setText.instance_method = true;
    __ui_MenuItem.prototype.setParentMenu = function(parentMenu) {
    this.parentMenu = parentMenu;
    };
    __ui_MenuItem.prototype.__class__.setParentMenu = function() {
        return __ui_MenuItem.prototype.setParentMenu.call.apply(__ui_MenuItem.prototype.setParentMenu, arguments);
    };
    __ui_MenuItem.prototype.__class__.setParentMenu.unbound_method = true;
    __ui_MenuItem.prototype.setParentMenu.instance_method = true;
    __ui_MenuItem.prototype.setSelectionStyle = function(selected) {
    if (selected) {
    this.addStyleName('gwt-MenuItem-selected');
    }
    else {
    this.removeStyleName('gwt-MenuItem-selected');
    }
    };
    __ui_MenuItem.prototype.__class__.setSelectionStyle = function() {
        return __ui_MenuItem.prototype.setSelectionStyle.call.apply(__ui_MenuItem.prototype.setSelectionStyle, arguments);
    };
    __ui_MenuItem.prototype.__class__.setSelectionStyle.unbound_method = true;
    __ui_MenuItem.prototype.setSelectionStyle.instance_method = true;
}
function __ui_MenuBar() {
}
function ui_MenuBar(vertical) {
    if (typeof vertical == 'undefined') vertical=false;
    var instance = new __ui_MenuBar();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_MenuBar.parse_kwargs = function ( __kwargs, vertical ) {
    if (typeof vertical == 'undefined')
        vertical=__kwargs.vertical;
    var __r = [vertical];
    return __r;
};
function __ui_MenuBar_initialize() {
    if(__ui_MenuBar.__was_initialized__) return;
    __ui_MenuBar.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_MenuBar, __ui_Widget);
    __ui_MenuBar.prototype.__class__.__new__ = ui_MenuBar;
    __ui_MenuBar.prototype.__init__ = function(vertical) {
    if (typeof vertical == 'undefined') vertical=false;
    __ui_Widget.prototype.__class__.__init__(this);
    this.body = null;
    this.items = new pyjslib_List([]);
    this.parentMenu = null;
    this.popup = null;
    this.selectedItem = null;
    this.shownChildMenu = null;
    this.vertical = false;
    this.autoOpen = false;
    __ui_Widget.prototype.__class__.__init__(this);
    var table = DOM_createTable();
    this.body = DOM_createTBody();
    DOM_appendChild(table, this.body);
    if (!(vertical)) {
    var tr = DOM_createTR();
    DOM_appendChild(this.body, tr);
    }
    this.vertical = vertical;
    var outer = DOM_createDiv();
    DOM_appendChild(outer, table);
    this.setElement(outer);
    this.setStyleName('gwt-MenuBar');
    };
__ui_MenuBar.prototype.__init__.parse_kwargs = function ( __kwargs, vertical ) {
    if (typeof vertical == 'undefined')
        vertical=__kwargs.vertical;
    var __r = [vertical];
    return __r;
};
    __ui_MenuBar.prototype.__class__.__init__ = function() {
        return __ui_MenuBar.prototype.__init__.call.apply(__ui_MenuBar.prototype.__init__, arguments);
    };
    __ui_MenuBar.prototype.__class__.__init__.unbound_method = true;
    __ui_MenuBar.prototype.__init__.instance_method = true;
    __ui_MenuBar.prototype.__class__.__init__.parse_kwargs = __ui_MenuBar.prototype.__init__.parse_kwargs;
    __ui_MenuBar.prototype.addItem = function(item, asHTML, popup) {
    if (typeof asHTML == 'undefined') asHTML=null;
    if (typeof popup == 'undefined') popup=null;
    if (!(pyjslib_hasattr(item, 'setSubMenu'))) {
    var item = ui_MenuItem(item, asHTML, popup);
    }
    if (this.vertical) {
    var tr = DOM_createTR();
    DOM_appendChild(this.body, tr);
    }
    else {
    var tr = DOM_getChild(this.body, 0);
    }
    DOM_appendChild(tr, item.getElement());
    item.setParentMenu(this);
    item.setSelectionStyle(false);
    this.items.append(item);
    return item;
    };
__ui_MenuBar.prototype.addItem.parse_kwargs = function ( __kwargs, item, asHTML, popup ) {
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    if (typeof popup == 'undefined')
        popup=__kwargs.popup;
    var __r = [item, asHTML, popup];
    return __r;
};
    __ui_MenuBar.prototype.__class__.addItem = function() {
        return __ui_MenuBar.prototype.addItem.call.apply(__ui_MenuBar.prototype.addItem, arguments);
    };
    __ui_MenuBar.prototype.__class__.addItem.unbound_method = true;
    __ui_MenuBar.prototype.addItem.instance_method = true;
    __ui_MenuBar.prototype.__class__.addItem.parse_kwargs = __ui_MenuBar.prototype.addItem.parse_kwargs;
    __ui_MenuBar.prototype.clearItems = function() {
    var container = this.getItemContainerElement();
    while ((DOM_getChildCount(container) > 0)) {
    DOM_removeChild(container, DOM_getChild(container, 0));
    }
    this.items = new pyjslib_List([]);
    };
    __ui_MenuBar.prototype.__class__.clearItems = function() {
        return __ui_MenuBar.prototype.clearItems.call.apply(__ui_MenuBar.prototype.clearItems, arguments);
    };
    __ui_MenuBar.prototype.__class__.clearItems.unbound_method = true;
    __ui_MenuBar.prototype.clearItems.instance_method = true;
    __ui_MenuBar.prototype.getAutoOpen = function() {
    return this.autoOpen;
    };
    __ui_MenuBar.prototype.__class__.getAutoOpen = function() {
        return __ui_MenuBar.prototype.getAutoOpen.call.apply(__ui_MenuBar.prototype.getAutoOpen, arguments);
    };
    __ui_MenuBar.prototype.__class__.getAutoOpen.unbound_method = true;
    __ui_MenuBar.prototype.getAutoOpen.instance_method = true;
    __ui_MenuBar.prototype.onBrowserEvent = function(event) {
    __ui_Widget.prototype.__class__.onBrowserEvent(this, event);
    var item = this.findItem(DOM_eventGetTarget(event));
    if ((item == null)) {
    return;
    }
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    this.doItemAction(item, true);
    }
    else if ((type == 'mouseover')) {
    this.itemOver(item);
    }
    else if ((type == 'mouseout')) {
    this.itemOver(null);
    }
    };
    __ui_MenuBar.prototype.__class__.onBrowserEvent = function() {
        return __ui_MenuBar.prototype.onBrowserEvent.call.apply(__ui_MenuBar.prototype.onBrowserEvent, arguments);
    };
    __ui_MenuBar.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_MenuBar.prototype.onBrowserEvent.instance_method = true;
    __ui_MenuBar.prototype.onPopupClosed = function(sender, autoClosed) {
    if (autoClosed) {
    this.closeAllParents();
    }
    this.onHide();
    this.shownChildMenu = null;
    this.popup = null;
    };
    __ui_MenuBar.prototype.__class__.onPopupClosed = function() {
        return __ui_MenuBar.prototype.onPopupClosed.call.apply(__ui_MenuBar.prototype.onPopupClosed, arguments);
    };
    __ui_MenuBar.prototype.__class__.onPopupClosed.unbound_method = true;
    __ui_MenuBar.prototype.onPopupClosed.instance_method = true;
    __ui_MenuBar.prototype.removeItem = function(item) {
    var idx = this.items.index(item);
    if ((idx == -1)) {
    return;
    }
    var container = this.getItemContainerElement();
    DOM_removeChild(container, DOM_getChild(container, idx));
    this.items.__delitem__(idx);
    };
    __ui_MenuBar.prototype.__class__.removeItem = function() {
        return __ui_MenuBar.prototype.removeItem.call.apply(__ui_MenuBar.prototype.removeItem, arguments);
    };
    __ui_MenuBar.prototype.__class__.removeItem.unbound_method = true;
    __ui_MenuBar.prototype.removeItem.instance_method = true;
    __ui_MenuBar.prototype.setAutoOpen = function(autoOpen) {
    this.autoOpen = autoOpen;
    };
    __ui_MenuBar.prototype.__class__.setAutoOpen = function() {
        return __ui_MenuBar.prototype.setAutoOpen.call.apply(__ui_MenuBar.prototype.setAutoOpen, arguments);
    };
    __ui_MenuBar.prototype.__class__.setAutoOpen.unbound_method = true;
    __ui_MenuBar.prototype.setAutoOpen.instance_method = true;
    __ui_MenuBar.prototype.closeAllParents = function() {
    var curMenu = this;
    while ((curMenu != null)) {
    curMenu.close();
    if (((curMenu.parentMenu == null)) && ((curMenu.selectedItem != null))) {
    curMenu.selectedItem.setSelectionStyle(false);
    curMenu.selectedItem = null;
    }
    var curMenu = curMenu.parentMenu;
    }
    };
    __ui_MenuBar.prototype.__class__.closeAllParents = function() {
        return __ui_MenuBar.prototype.closeAllParents.call.apply(__ui_MenuBar.prototype.closeAllParents, arguments);
    };
    __ui_MenuBar.prototype.__class__.closeAllParents.unbound_method = true;
    __ui_MenuBar.prototype.closeAllParents.instance_method = true;
    __ui_MenuBar.prototype.doItemAction = function(item, fireCommand) {
    if (((this.shownChildMenu != null)) && ((item.getSubMenu() == this.shownChildMenu))) {
    return;
    }
    if ((this.shownChildMenu != null)) {
    this.shownChildMenu.onHide();
    this.popup.hide();
    }
    if ((item.getSubMenu() == null)) {
    if (fireCommand) {
    this.closeAllParents();
    var cmd = item.getCommand();
    if ((cmd != null)) {
    DeferredCommand_DeferredCommand().add(cmd);
    }
    }
    return;
    }
    this.selectItem(item);
    this.popup = ui_MenuBarPopupPanel(item);
    this.popup.addPopupListener(this);
    if (this.vertical) {
    this.popup.setPopupPosition( ( item.getAbsoluteLeft() + item.getOffsetWidth() ) , item.getAbsoluteTop());
    }
    else {
    this.popup.setPopupPosition(item.getAbsoluteLeft(),  ( item.getAbsoluteTop() + item.getOffsetHeight() ) );
    }
    this.shownChildMenu = item.getSubMenu();
    var sub_menu = item.getSubMenu();
    sub_menu.parentMenu = this;
    this.popup.show();
    };
    __ui_MenuBar.prototype.__class__.doItemAction = function() {
        return __ui_MenuBar.prototype.doItemAction.call.apply(__ui_MenuBar.prototype.doItemAction, arguments);
    };
    __ui_MenuBar.prototype.__class__.doItemAction.unbound_method = true;
    __ui_MenuBar.prototype.doItemAction.instance_method = true;
    __ui_MenuBar.prototype.onDetach = function() {
    if ((this.popup != null)) {
    this.popup.hide();
    }
    __ui_Widget.prototype.__class__.onDetach(this);
    };
    __ui_MenuBar.prototype.__class__.onDetach = function() {
        return __ui_MenuBar.prototype.onDetach.call.apply(__ui_MenuBar.prototype.onDetach, arguments);
    };
    __ui_MenuBar.prototype.__class__.onDetach.unbound_method = true;
    __ui_MenuBar.prototype.onDetach.instance_method = true;
    __ui_MenuBar.prototype.itemOver = function(item) {
    if ((item == null)) {
    if (((this.selectedItem != null)) && ((this.shownChildMenu == this.selectedItem.getSubMenu()))) {
    return;
    }
    }
    this.selectItem(item);
    if ((item != null)) {
    if (((this.shownChildMenu != null)) || ((this.parentMenu != null)) || (this.autoOpen)) {
    this.doItemAction(item, false);
    }
    }
    };
    __ui_MenuBar.prototype.__class__.itemOver = function() {
        return __ui_MenuBar.prototype.itemOver.call.apply(__ui_MenuBar.prototype.itemOver, arguments);
    };
    __ui_MenuBar.prototype.__class__.itemOver.unbound_method = true;
    __ui_MenuBar.prototype.itemOver.instance_method = true;
    __ui_MenuBar.prototype.close = function() {
    if ((this.parentMenu != null)) {
    this.parentMenu.popup.hide();
    }
    };
    __ui_MenuBar.prototype.__class__.close = function() {
        return __ui_MenuBar.prototype.close.call.apply(__ui_MenuBar.prototype.close, arguments);
    };
    __ui_MenuBar.prototype.__class__.close.unbound_method = true;
    __ui_MenuBar.prototype.close.instance_method = true;
    __ui_MenuBar.prototype.findItem = function(hItem) {

        var __item = this.items.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    if (DOM_isOrHasChild(item.getElement(), hItem)) {
    return item;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return;
    };
    __ui_MenuBar.prototype.__class__.findItem = function() {
        return __ui_MenuBar.prototype.findItem.call.apply(__ui_MenuBar.prototype.findItem, arguments);
    };
    __ui_MenuBar.prototype.__class__.findItem.unbound_method = true;
    __ui_MenuBar.prototype.findItem.instance_method = true;
    __ui_MenuBar.prototype.getItemContainerElement = function() {
    if (this.vertical) {
    return this.body;
    }
    else {
    return DOM_getChild(this.body, 0);
    }
    };
    __ui_MenuBar.prototype.__class__.getItemContainerElement = function() {
        return __ui_MenuBar.prototype.getItemContainerElement.call.apply(__ui_MenuBar.prototype.getItemContainerElement, arguments);
    };
    __ui_MenuBar.prototype.__class__.getItemContainerElement.unbound_method = true;
    __ui_MenuBar.prototype.getItemContainerElement.instance_method = true;
    __ui_MenuBar.prototype.onHide = function() {
    if ((this.shownChildMenu != null)) {
    this.shownChildMenu.onHide();
    this.popup.hide();
    }
    };
    __ui_MenuBar.prototype.__class__.onHide = function() {
        return __ui_MenuBar.prototype.onHide.call.apply(__ui_MenuBar.prototype.onHide, arguments);
    };
    __ui_MenuBar.prototype.__class__.onHide.unbound_method = true;
    __ui_MenuBar.prototype.onHide.instance_method = true;
    __ui_MenuBar.prototype.onShow = function() {
    if ((pyjslib_len(this.items) > 0)) {
    this.selectItem(this.items.__getitem__(0));
    }
    };
    __ui_MenuBar.prototype.__class__.onShow = function() {
        return __ui_MenuBar.prototype.onShow.call.apply(__ui_MenuBar.prototype.onShow, arguments);
    };
    __ui_MenuBar.prototype.__class__.onShow.unbound_method = true;
    __ui_MenuBar.prototype.onShow.instance_method = true;
    __ui_MenuBar.prototype.selectItem = function(item) {
    if ((item == this.selectedItem)) {
    return;
    }
    if ((this.selectedItem != null)) {
    this.selectedItem.setSelectionStyle(false);
    }
    if ((item != null)) {
    item.setSelectionStyle(true);
    }
    this.selectedItem = item;
    };
    __ui_MenuBar.prototype.__class__.selectItem = function() {
        return __ui_MenuBar.prototype.selectItem.call.apply(__ui_MenuBar.prototype.selectItem, arguments);
    };
    __ui_MenuBar.prototype.__class__.selectItem.unbound_method = true;
    __ui_MenuBar.prototype.selectItem.instance_method = true;
}
function __ui_MenuBarPopupPanel() {
}
function ui_MenuBarPopupPanel(item) {
    var instance = new __ui_MenuBarPopupPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_MenuBarPopupPanel_initialize() {
    if(__ui_MenuBarPopupPanel.__was_initialized__) return;
    __ui_MenuBarPopupPanel.__was_initialized__ = true;
    if(!__ui_PopupPanel.__was_initialized__)
        __ui_PopupPanel_initialize();
    pyjs_extend(__ui_MenuBarPopupPanel, __ui_PopupPanel);
    __ui_MenuBarPopupPanel.prototype.__class__.__new__ = ui_MenuBarPopupPanel;
    __ui_MenuBarPopupPanel.prototype.__init__ = function(item) {
    this.item = item;
    __ui_PopupPanel.prototype.__class__.__init__(this, true);
    this.setWidget(item.getSubMenu());
    item.getSubMenu().onShow();
    };
    __ui_MenuBarPopupPanel.prototype.__class__.__init__ = function() {
        return __ui_MenuBarPopupPanel.prototype.__init__.call.apply(__ui_MenuBarPopupPanel.prototype.__init__, arguments);
    };
    __ui_MenuBarPopupPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_MenuBarPopupPanel.prototype.__init__.instance_method = true;
    __ui_MenuBarPopupPanel.prototype.onEventPreview = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    var target = DOM_eventGetTarget(event);
    var parentMenuElement = this.item.getParentMenu().getElement();
    if (DOM_isOrHasChild(parentMenuElement, target)) {
    return false;
    }
    }
    return __ui_PopupPanel.prototype.__class__.onEventPreview(this, event);
    };
    __ui_MenuBarPopupPanel.prototype.__class__.onEventPreview = function() {
        return __ui_MenuBarPopupPanel.prototype.onEventPreview.call.apply(__ui_MenuBarPopupPanel.prototype.onEventPreview, arguments);
    };
    __ui_MenuBarPopupPanel.prototype.__class__.onEventPreview.unbound_method = true;
    __ui_MenuBarPopupPanel.prototype.onEventPreview.instance_method = true;
}
function __ui_ListBox() {
}
function ui_ListBox() {
    var instance = new __ui_ListBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ListBox_initialize() {
    if(__ui_ListBox.__was_initialized__) return;
    __ui_ListBox.__was_initialized__ = true;
    if(!__ui_FocusWidget.__was_initialized__)
        __ui_FocusWidget_initialize();
    pyjs_extend(__ui_ListBox, __ui_FocusWidget);
    __ui_ListBox.prototype.__class__.__new__ = ui_ListBox;
    __ui_ListBox.prototype.__init__ = function() {
    this.changeListeners = new pyjslib_List([]);
    this.INSERT_AT_END = -1;
    __ui_FocusWidget.prototype.__class__.__init__(this, DOM_createSelect());
    this.sinkEvents(__ui_Event.prototype.__class__.ONCHANGE);
    this.setStyleName('gwt-ListBox');
    };
    __ui_ListBox.prototype.__class__.__init__ = function() {
        return __ui_ListBox.prototype.__init__.call.apply(__ui_ListBox.prototype.__init__, arguments);
    };
    __ui_ListBox.prototype.__class__.__init__.unbound_method = true;
    __ui_ListBox.prototype.__init__.instance_method = true;
    __ui_ListBox.prototype.addChangeListener = function(listener) {
    this.changeListeners.append(listener);
    };
    __ui_ListBox.prototype.__class__.addChangeListener = function() {
        return __ui_ListBox.prototype.addChangeListener.call.apply(__ui_ListBox.prototype.addChangeListener, arguments);
    };
    __ui_ListBox.prototype.__class__.addChangeListener.unbound_method = true;
    __ui_ListBox.prototype.addChangeListener.instance_method = true;
    __ui_ListBox.prototype.addItem = function(item, value) {
    if (typeof value == 'undefined') value=null;
    this.insertItem(item, value, this.INSERT_AT_END);
    };
__ui_ListBox.prototype.addItem.parse_kwargs = function ( __kwargs, item, value ) {
    if (typeof value == 'undefined')
        value=__kwargs.value;
    var __r = [item, value];
    return __r;
};
    __ui_ListBox.prototype.__class__.addItem = function() {
        return __ui_ListBox.prototype.addItem.call.apply(__ui_ListBox.prototype.addItem, arguments);
    };
    __ui_ListBox.prototype.__class__.addItem.unbound_method = true;
    __ui_ListBox.prototype.addItem.instance_method = true;
    __ui_ListBox.prototype.__class__.addItem.parse_kwargs = __ui_ListBox.prototype.addItem.parse_kwargs;
    __ui_ListBox.prototype.clear = function() {
    var h = this.getElement();
    while ((DOM_getChildCount(h) > 0)) {
    DOM_removeChild(h, DOM_getChild(h, 0));
    }
    };
    __ui_ListBox.prototype.__class__.clear = function() {
        return __ui_ListBox.prototype.clear.call.apply(__ui_ListBox.prototype.clear, arguments);
    };
    __ui_ListBox.prototype.__class__.clear.unbound_method = true;
    __ui_ListBox.prototype.clear.instance_method = true;
    __ui_ListBox.prototype.getItemCount = function() {
    return DOM_getChildCount(this.getElement());
    };
    __ui_ListBox.prototype.__class__.getItemCount = function() {
        return __ui_ListBox.prototype.getItemCount.call.apply(__ui_ListBox.prototype.getItemCount, arguments);
    };
    __ui_ListBox.prototype.__class__.getItemCount.unbound_method = true;
    __ui_ListBox.prototype.getItemCount.instance_method = true;
    __ui_ListBox.prototype.getItemText = function(index) {
    var child = DOM_getChild(this.getElement(), index);
    return DOM_getInnerText(child);
    };
    __ui_ListBox.prototype.__class__.getItemText = function() {
        return __ui_ListBox.prototype.getItemText.call.apply(__ui_ListBox.prototype.getItemText, arguments);
    };
    __ui_ListBox.prototype.__class__.getItemText.unbound_method = true;
    __ui_ListBox.prototype.getItemText.instance_method = true;
    __ui_ListBox.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_ListBox.prototype.__class__.getName = function() {
        return __ui_ListBox.prototype.getName.call.apply(__ui_ListBox.prototype.getName, arguments);
    };
    __ui_ListBox.prototype.__class__.getName.unbound_method = true;
    __ui_ListBox.prototype.getName.instance_method = true;
    __ui_ListBox.prototype.getSelectedIndex = function() {
    return DOM_getIntAttribute(this.getElement(), 'selectedIndex');
    };
    __ui_ListBox.prototype.__class__.getSelectedIndex = function() {
        return __ui_ListBox.prototype.getSelectedIndex.call.apply(__ui_ListBox.prototype.getSelectedIndex, arguments);
    };
    __ui_ListBox.prototype.__class__.getSelectedIndex.unbound_method = true;
    __ui_ListBox.prototype.getSelectedIndex.instance_method = true;
    __ui_ListBox.prototype.getValue = function(index) {
    this.checkIndex(index);
    var option = DOM_getChild(this.getElement(), index);
    return DOM_getAttribute(option, 'value');
    };
    __ui_ListBox.prototype.__class__.getValue = function() {
        return __ui_ListBox.prototype.getValue.call.apply(__ui_ListBox.prototype.getValue, arguments);
    };
    __ui_ListBox.prototype.__class__.getValue.unbound_method = true;
    __ui_ListBox.prototype.getValue.instance_method = true;
    __ui_ListBox.prototype.getVisibleItemCount = function() {
    return DOM_getIntAttribute(this.getElement(), 'size');
    };
    __ui_ListBox.prototype.__class__.getVisibleItemCount = function() {
        return __ui_ListBox.prototype.getVisibleItemCount.call.apply(__ui_ListBox.prototype.getVisibleItemCount, arguments);
    };
    __ui_ListBox.prototype.__class__.getVisibleItemCount.unbound_method = true;
    __ui_ListBox.prototype.getVisibleItemCount.instance_method = true;
    __ui_ListBox.prototype.insertItem = function(item, value, index) {
    if (typeof index == 'undefined') index=null;
    if ((index == null)) {
    var index = value;
    var value = null;
    }
    DOM_insertListItem(this.getElement(), item, value, index);
    };
__ui_ListBox.prototype.insertItem.parse_kwargs = function ( __kwargs, item, value, index ) {
    if (typeof index == 'undefined')
        index=__kwargs.index;
    var __r = [item, value, index];
    return __r;
};
    __ui_ListBox.prototype.__class__.insertItem = function() {
        return __ui_ListBox.prototype.insertItem.call.apply(__ui_ListBox.prototype.insertItem, arguments);
    };
    __ui_ListBox.prototype.__class__.insertItem.unbound_method = true;
    __ui_ListBox.prototype.insertItem.instance_method = true;
    __ui_ListBox.prototype.__class__.insertItem.parse_kwargs = __ui_ListBox.prototype.insertItem.parse_kwargs;
    __ui_ListBox.prototype.isItemSelected = function(index) {
    this.checkIndex(index);
    var option = DOM_getChild(this.getElement(), index);
    return DOM_getBooleanAttribute(option, 'selected');
    };
    __ui_ListBox.prototype.__class__.isItemSelected = function() {
        return __ui_ListBox.prototype.isItemSelected.call.apply(__ui_ListBox.prototype.isItemSelected, arguments);
    };
    __ui_ListBox.prototype.__class__.isItemSelected.unbound_method = true;
    __ui_ListBox.prototype.isItemSelected.instance_method = true;
    __ui_ListBox.prototype.isMultipleSelect = function() {
    return DOM_getBooleanAttribute(this.getElement(), 'multiple');
    };
    __ui_ListBox.prototype.__class__.isMultipleSelect = function() {
        return __ui_ListBox.prototype.isMultipleSelect.call.apply(__ui_ListBox.prototype.isMultipleSelect, arguments);
    };
    __ui_ListBox.prototype.__class__.isMultipleSelect.unbound_method = true;
    __ui_ListBox.prototype.isMultipleSelect.instance_method = true;
    __ui_ListBox.prototype.onBrowserEvent = function(event) {
    if ((DOM_eventGetType(event) == 'change')) {

        var __listener = this.changeListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onChange) {
    listener.onChange(this);
    }
    else {
    listener(this);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else {
    __ui_FocusWidget.prototype.__class__.onBrowserEvent(this, event);
    }
    };
    __ui_ListBox.prototype.__class__.onBrowserEvent = function() {
        return __ui_ListBox.prototype.onBrowserEvent.call.apply(__ui_ListBox.prototype.onBrowserEvent, arguments);
    };
    __ui_ListBox.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_ListBox.prototype.onBrowserEvent.instance_method = true;
    __ui_ListBox.prototype.removeChangeListener = function(listener) {
    this.changeListeners.remove(listener);
    };
    __ui_ListBox.prototype.__class__.removeChangeListener = function() {
        return __ui_ListBox.prototype.removeChangeListener.call.apply(__ui_ListBox.prototype.removeChangeListener, arguments);
    };
    __ui_ListBox.prototype.__class__.removeChangeListener.unbound_method = true;
    __ui_ListBox.prototype.removeChangeListener.instance_method = true;
    __ui_ListBox.prototype.removeItem = function(idx) {
    var child = DOM_getChild(this.getElement(), idx);
    DOM_removeChild(this.getElement(), child);
    };
    __ui_ListBox.prototype.__class__.removeItem = function() {
        return __ui_ListBox.prototype.removeItem.call.apply(__ui_ListBox.prototype.removeItem, arguments);
    };
    __ui_ListBox.prototype.__class__.removeItem.unbound_method = true;
    __ui_ListBox.prototype.removeItem.instance_method = true;
    __ui_ListBox.prototype.setItemSelected = function(index, selected) {
    this.checkIndex(index);
    var option = DOM_getChild(this.getElement(), index);
    DOM_setBooleanAttribute(option, 'selected', selected);
    };
    __ui_ListBox.prototype.__class__.setItemSelected = function() {
        return __ui_ListBox.prototype.setItemSelected.call.apply(__ui_ListBox.prototype.setItemSelected, arguments);
    };
    __ui_ListBox.prototype.__class__.setItemSelected.unbound_method = true;
    __ui_ListBox.prototype.setItemSelected.instance_method = true;
    __ui_ListBox.prototype.setMultipleSelect = function(multiple) {
    DOM_setBooleanAttribute(this.getElement(), 'multiple', multiple);
    };
    __ui_ListBox.prototype.__class__.setMultipleSelect = function() {
        return __ui_ListBox.prototype.setMultipleSelect.call.apply(__ui_ListBox.prototype.setMultipleSelect, arguments);
    };
    __ui_ListBox.prototype.__class__.setMultipleSelect.unbound_method = true;
    __ui_ListBox.prototype.setMultipleSelect.instance_method = true;
    __ui_ListBox.prototype.setName = function(name) {
    DOM_setAttribute(this.getElement(), 'name', name);
    };
    __ui_ListBox.prototype.__class__.setName = function() {
        return __ui_ListBox.prototype.setName.call.apply(__ui_ListBox.prototype.setName, arguments);
    };
    __ui_ListBox.prototype.__class__.setName.unbound_method = true;
    __ui_ListBox.prototype.setName.instance_method = true;
    __ui_ListBox.prototype.setSelectedIndex = function(index) {
    DOM_setIntAttribute(this.getElement(), 'selectedIndex', index);
    };
    __ui_ListBox.prototype.__class__.setSelectedIndex = function() {
        return __ui_ListBox.prototype.setSelectedIndex.call.apply(__ui_ListBox.prototype.setSelectedIndex, arguments);
    };
    __ui_ListBox.prototype.__class__.setSelectedIndex.unbound_method = true;
    __ui_ListBox.prototype.setSelectedIndex.instance_method = true;
    __ui_ListBox.prototype.selectValue = function(value) {

        var __n = pyjslib_range(this.getItemCount()).__iter__();
        try {
            while (true) {
                var n = __n.next();
                
        
    if ((this.getItemText(n) == value)) {
    this.setSelectedIndex(n);
    return n;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return;
    };
    __ui_ListBox.prototype.__class__.selectValue = function() {
        return __ui_ListBox.prototype.selectValue.call.apply(__ui_ListBox.prototype.selectValue, arguments);
    };
    __ui_ListBox.prototype.__class__.selectValue.unbound_method = true;
    __ui_ListBox.prototype.selectValue.instance_method = true;
    __ui_ListBox.prototype.setItemText = function(index, text) {
    this.checkIndex(index);
    if ((text == null)) {
    console.error('Cannot set an option to have null text');
    return;
    }
    DOM_setOptionText(this.getElement(), text, index);
    };
    __ui_ListBox.prototype.__class__.setItemText = function() {
        return __ui_ListBox.prototype.setItemText.call.apply(__ui_ListBox.prototype.setItemText, arguments);
    };
    __ui_ListBox.prototype.__class__.setItemText.unbound_method = true;
    __ui_ListBox.prototype.setItemText.instance_method = true;
    __ui_ListBox.prototype.setValue = function(index, value) {
    this.checkIndex(index);
    var option = DOM_getChild(this.getElement(), index);
    DOM_setAttribute(option, 'value', value);
    };
    __ui_ListBox.prototype.__class__.setValue = function() {
        return __ui_ListBox.prototype.setValue.call.apply(__ui_ListBox.prototype.setValue, arguments);
    };
    __ui_ListBox.prototype.__class__.setValue.unbound_method = true;
    __ui_ListBox.prototype.setValue.instance_method = true;
    __ui_ListBox.prototype.setVisibleItemCount = function(visibleItems) {
    DOM_setIntAttribute(this.getElement(), 'size', visibleItems);
    };
    __ui_ListBox.prototype.__class__.setVisibleItemCount = function() {
        return __ui_ListBox.prototype.setVisibleItemCount.call.apply(__ui_ListBox.prototype.setVisibleItemCount, arguments);
    };
    __ui_ListBox.prototype.__class__.setVisibleItemCount.unbound_method = true;
    __ui_ListBox.prototype.setVisibleItemCount.instance_method = true;
    __ui_ListBox.prototype.checkIndex = function(index) {
    var elem = this.getElement();
    if (((index < 0)) || ((index >= DOM_getChildCount(elem)))) {
    }
    };
    __ui_ListBox.prototype.__class__.checkIndex = function() {
        return __ui_ListBox.prototype.checkIndex.call.apply(__ui_ListBox.prototype.checkIndex, arguments);
    };
    __ui_ListBox.prototype.__class__.checkIndex.unbound_method = true;
    __ui_ListBox.prototype.checkIndex.instance_method = true;
}
function __ui_DialogBox() {
}
function ui_DialogBox(autoHide, modal) {
    if (typeof autoHide == 'undefined') autoHide=null;
    if (typeof modal == 'undefined') modal=true;
    var instance = new __ui_DialogBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_DialogBox.parse_kwargs = function ( __kwargs, autoHide, modal ) {
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    if (typeof modal == 'undefined')
        modal=__kwargs.modal;
    var __r = [autoHide, modal];
    return __r;
};
function __ui_DialogBox_initialize() {
    if(__ui_DialogBox.__was_initialized__) return;
    __ui_DialogBox.__was_initialized__ = true;
    if(!__ui_PopupPanel.__was_initialized__)
        __ui_PopupPanel_initialize();
    pyjs_extend(__ui_DialogBox, __ui_PopupPanel);
    __ui_DialogBox.prototype.__class__.__new__ = ui_DialogBox;
    __ui_DialogBox.prototype.__init__ = function(autoHide, modal) {
    if (typeof autoHide == 'undefined') autoHide=null;
    if (typeof modal == 'undefined') modal=true;
    __ui_PopupPanel.prototype.__class__.__init__(this, autoHide, modal);
    this.caption = ui_HTML();
    this.child = null;
    this.dragging = false;
    this.dragStartX = 0;
    this.dragStartY = 0;
    this.panel = ui_FlexTable();
    this.panel.setWidget(0, 0, this.caption);
    this.panel.setHeight('100%');
    this.panel.setBorderWidth(0);
    this.panel.setCellPadding(0);
    this.panel.setCellSpacing(0);
    this.panel.getCellFormatter().setHeight(1, 0, '100%');
    this.panel.getCellFormatter().setWidth(1, 0, '100%');
    this.panel.getCellFormatter().setAlignment(1, 0, __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_CENTER, __ui_HasVerticalAlignment.prototype.__class__.ALIGN_MIDDLE);
    __ui_PopupPanel.prototype.__class__.setWidget(this, this.panel);
    this.setStyleName('gwt-DialogBox');
    this.caption.setStyleName('Caption');
    this.caption.addMouseListener(this);
    };
__ui_DialogBox.prototype.__init__.parse_kwargs = function ( __kwargs, autoHide, modal ) {
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    if (typeof modal == 'undefined')
        modal=__kwargs.modal;
    var __r = [autoHide, modal];
    return __r;
};
    __ui_DialogBox.prototype.__class__.__init__ = function() {
        return __ui_DialogBox.prototype.__init__.call.apply(__ui_DialogBox.prototype.__init__, arguments);
    };
    __ui_DialogBox.prototype.__class__.__init__.unbound_method = true;
    __ui_DialogBox.prototype.__init__.instance_method = true;
    __ui_DialogBox.prototype.__class__.__init__.parse_kwargs = __ui_DialogBox.prototype.__init__.parse_kwargs;
    __ui_DialogBox.prototype.getHTML = function() {
    return this.caption.getHTML();
    };
    __ui_DialogBox.prototype.__class__.getHTML = function() {
        return __ui_DialogBox.prototype.getHTML.call.apply(__ui_DialogBox.prototype.getHTML, arguments);
    };
    __ui_DialogBox.prototype.__class__.getHTML.unbound_method = true;
    __ui_DialogBox.prototype.getHTML.instance_method = true;
    __ui_DialogBox.prototype.getText = function() {
    return this.caption.getText();
    };
    __ui_DialogBox.prototype.__class__.getText = function() {
        return __ui_DialogBox.prototype.getText.call.apply(__ui_DialogBox.prototype.getText, arguments);
    };
    __ui_DialogBox.prototype.__class__.getText.unbound_method = true;
    __ui_DialogBox.prototype.getText.instance_method = true;
    __ui_DialogBox.prototype.onEventPreview = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'mousedown')) {
    var target = DOM_eventGetTarget(event);
    var elem = this.caption.getElement();
    var event_targets_popup = (target) && (DOM_isOrHasChild(elem, target));
    if (event_targets_popup) {
    DOM_eventPreventDefault(event);
    }
    }
    return __ui_PopupPanel.prototype.__class__.onEventPreview(this, event);
    };
    __ui_DialogBox.prototype.__class__.onEventPreview = function() {
        return __ui_DialogBox.prototype.onEventPreview.call.apply(__ui_DialogBox.prototype.onEventPreview, arguments);
    };
    __ui_DialogBox.prototype.__class__.onEventPreview.unbound_method = true;
    __ui_DialogBox.prototype.onEventPreview.instance_method = true;
    __ui_DialogBox.prototype.onMouseDown = function(sender, x, y) {
    this.dragging = true;
    DOM_setCapture(this.caption.getElement());
    this.dragStartX = x;
    this.dragStartY = y;
    };
    __ui_DialogBox.prototype.__class__.onMouseDown = function() {
        return __ui_DialogBox.prototype.onMouseDown.call.apply(__ui_DialogBox.prototype.onMouseDown, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseDown.unbound_method = true;
    __ui_DialogBox.prototype.onMouseDown.instance_method = true;
    __ui_DialogBox.prototype.onMouseEnter = function(sender) {
    };
    __ui_DialogBox.prototype.__class__.onMouseEnter = function() {
        return __ui_DialogBox.prototype.onMouseEnter.call.apply(__ui_DialogBox.prototype.onMouseEnter, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseEnter.unbound_method = true;
    __ui_DialogBox.prototype.onMouseEnter.instance_method = true;
    __ui_DialogBox.prototype.onMouseLeave = function(sender) {
    };
    __ui_DialogBox.prototype.__class__.onMouseLeave = function() {
        return __ui_DialogBox.prototype.onMouseLeave.call.apply(__ui_DialogBox.prototype.onMouseLeave, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseLeave.unbound_method = true;
    __ui_DialogBox.prototype.onMouseLeave.instance_method = true;
    __ui_DialogBox.prototype.onMouseMove = function(sender, x, y) {
    if (this.dragging) {
    var absX =  ( x + this.getAbsoluteLeft() ) ;
    var absY =  ( y + this.getAbsoluteTop() ) ;
    this.setPopupPosition( ( absX - this.dragStartX ) ,  ( absY - this.dragStartY ) );
    }
    };
    __ui_DialogBox.prototype.__class__.onMouseMove = function() {
        return __ui_DialogBox.prototype.onMouseMove.call.apply(__ui_DialogBox.prototype.onMouseMove, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseMove.unbound_method = true;
    __ui_DialogBox.prototype.onMouseMove.instance_method = true;
    __ui_DialogBox.prototype.onMouseUp = function(sender, x, y) {
    this.dragging = false;
    DOM_releaseCapture(this.caption.getElement());
    };
    __ui_DialogBox.prototype.__class__.onMouseUp = function() {
        return __ui_DialogBox.prototype.onMouseUp.call.apply(__ui_DialogBox.prototype.onMouseUp, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseUp.unbound_method = true;
    __ui_DialogBox.prototype.onMouseUp.instance_method = true;
    __ui_DialogBox.prototype.remove = function(widget) {
    if ((this.child != widget)) {
    return false;
    }
    this.panel.remove(widget);
    return true;
    };
    __ui_DialogBox.prototype.__class__.remove = function() {
        return __ui_DialogBox.prototype.remove.call.apply(__ui_DialogBox.prototype.remove, arguments);
    };
    __ui_DialogBox.prototype.__class__.remove.unbound_method = true;
    __ui_DialogBox.prototype.remove.instance_method = true;
    __ui_DialogBox.prototype.setHTML = function(html) {
    this.caption.setHTML(html);
    };
    __ui_DialogBox.prototype.__class__.setHTML = function() {
        return __ui_DialogBox.prototype.setHTML.call.apply(__ui_DialogBox.prototype.setHTML, arguments);
    };
    __ui_DialogBox.prototype.__class__.setHTML.unbound_method = true;
    __ui_DialogBox.prototype.setHTML.instance_method = true;
    __ui_DialogBox.prototype.setText = function(text) {
    this.caption.setText(text);
    };
    __ui_DialogBox.prototype.__class__.setText = function() {
        return __ui_DialogBox.prototype.setText.call.apply(__ui_DialogBox.prototype.setText, arguments);
    };
    __ui_DialogBox.prototype.__class__.setText.unbound_method = true;
    __ui_DialogBox.prototype.setText.instance_method = true;
    __ui_DialogBox.prototype.doAttachChildren = function() {
    __ui_PopupPanel.prototype.__class__.doAttachChildren(this);
    this.caption.onAttach();
    };
    __ui_DialogBox.prototype.__class__.doAttachChildren = function() {
        return __ui_DialogBox.prototype.doAttachChildren.call.apply(__ui_DialogBox.prototype.doAttachChildren, arguments);
    };
    __ui_DialogBox.prototype.__class__.doAttachChildren.unbound_method = true;
    __ui_DialogBox.prototype.doAttachChildren.instance_method = true;
    __ui_DialogBox.prototype.doDetachChildren = function() {
    __ui_PopupPanel.prototype.__class__.doDetachChildren(this);
    this.caption.onDetach();
    };
    __ui_DialogBox.prototype.__class__.doDetachChildren = function() {
        return __ui_DialogBox.prototype.doDetachChildren.call.apply(__ui_DialogBox.prototype.doDetachChildren, arguments);
    };
    __ui_DialogBox.prototype.__class__.doDetachChildren.unbound_method = true;
    __ui_DialogBox.prototype.doDetachChildren.instance_method = true;
    __ui_DialogBox.prototype.setWidget = function(widget) {
    if ((this.child != null)) {
    this.panel.remove(this.child);
    }
    if ((widget != null)) {
    this.panel.setWidget(1, 0, widget);
    }
    this.child = widget;
    };
    __ui_DialogBox.prototype.__class__.setWidget = function() {
        return __ui_DialogBox.prototype.setWidget.call.apply(__ui_DialogBox.prototype.setWidget, arguments);
    };
    __ui_DialogBox.prototype.__class__.setWidget.unbound_method = true;
    __ui_DialogBox.prototype.setWidget.instance_method = true;
}
function __ui_Frame() {
}
function ui_Frame(url) {
    if (typeof url == 'undefined') url='';
    var instance = new __ui_Frame();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Frame.parse_kwargs = function ( __kwargs, url ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    var __r = [url];
    return __r;
};
function __ui_Frame_initialize() {
    if(__ui_Frame.__was_initialized__) return;
    __ui_Frame.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Frame, __ui_Widget);
    __ui_Frame.prototype.__class__.__new__ = ui_Frame;
    __ui_Frame.prototype.__init__ = function(url) {
    if (typeof url == 'undefined') url='';
    __ui_Widget.prototype.__class__.__init__(this);
    this.setElement(DOM_createIFrame());
    if (url) {
    this.setUrl(url);
    }
    };
__ui_Frame.prototype.__init__.parse_kwargs = function ( __kwargs, url ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    var __r = [url];
    return __r;
};
    __ui_Frame.prototype.__class__.__init__ = function() {
        return __ui_Frame.prototype.__init__.call.apply(__ui_Frame.prototype.__init__, arguments);
    };
    __ui_Frame.prototype.__class__.__init__.unbound_method = true;
    __ui_Frame.prototype.__init__.instance_method = true;
    __ui_Frame.prototype.__class__.__init__.parse_kwargs = __ui_Frame.prototype.__init__.parse_kwargs;
    __ui_Frame.prototype.getUrl = function() {
    return DOM_getAttribute(this.getElement(), 'src');
    };
    __ui_Frame.prototype.__class__.getUrl = function() {
        return __ui_Frame.prototype.getUrl.call.apply(__ui_Frame.prototype.getUrl, arguments);
    };
    __ui_Frame.prototype.__class__.getUrl.unbound_method = true;
    __ui_Frame.prototype.getUrl.instance_method = true;
    __ui_Frame.prototype.setUrl = function(url) {
    return DOM_setAttribute(this.getElement(), 'src', url);
    };
    __ui_Frame.prototype.__class__.setUrl = function() {
        return __ui_Frame.prototype.setUrl.call.apply(__ui_Frame.prototype.setUrl, arguments);
    };
    __ui_Frame.prototype.__class__.setUrl.unbound_method = true;
    __ui_Frame.prototype.setUrl.instance_method = true;
}
function __ui_ClickDelegatePanel() {
}
function ui_ClickDelegatePanel(p, child, cDelegate, kDelegate) {
    var instance = new __ui_ClickDelegatePanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ClickDelegatePanel_initialize() {
    if(__ui_ClickDelegatePanel.__was_initialized__) return;
    __ui_ClickDelegatePanel.__was_initialized__ = true;
    if(!__ui_Composite.__was_initialized__)
        __ui_Composite_initialize();
    pyjs_extend(__ui_ClickDelegatePanel, __ui_Composite);
    __ui_ClickDelegatePanel.prototype.__class__.__new__ = ui_ClickDelegatePanel;
    __ui_ClickDelegatePanel.prototype.__init__ = function(p, child, cDelegate, kDelegate) {
    __ui_Composite.prototype.__class__.__init__(this);
    this.clickDelegate = cDelegate;
    this.keyDelegate = kDelegate;
    this.focusablePanel = ui_SimplePanel(ui_Focus().createFocusable());
    this.focusablePanel.setWidget(child);
    var wrapperWidget = p.createTabTextWrapper();
    if ((wrapperWidget == null)) {
    this.initWidget(this.focusablePanel);
    }
    else {
    wrapperWidget.setWidget(this.focusablePanel);
    this.initWidget(wrapperWidget);
    }
    child.addClickListener(this);
    if (pyjslib_hasattr(child, 'addKeyboardListener')) {
    child.addKeyboardListener(kDelegate);
    }
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.ONKEYDOWN));
    };
    __ui_ClickDelegatePanel.prototype.__class__.__init__ = function() {
        return __ui_ClickDelegatePanel.prototype.__init__.call.apply(__ui_ClickDelegatePanel.prototype.__init__, arguments);
    };
    __ui_ClickDelegatePanel.prototype.__class__.__init__.unbound_method = true;
    __ui_ClickDelegatePanel.prototype.__init__.instance_method = true;
    __ui_ClickDelegatePanel.prototype.onClick = function(sender, event) {
    this.clickDelegate.onClick(this, event);
    };
    __ui_ClickDelegatePanel.prototype.__class__.onClick = function() {
        return __ui_ClickDelegatePanel.prototype.onClick.call.apply(__ui_ClickDelegatePanel.prototype.onClick, arguments);
    };
    __ui_ClickDelegatePanel.prototype.__class__.onClick.unbound_method = true;
    __ui_ClickDelegatePanel.prototype.onClick.instance_method = true;
    __ui_ClickDelegatePanel.prototype.getFocusablePanel = function() {
    return this.focusablePanel;
    };
    __ui_ClickDelegatePanel.prototype.__class__.getFocusablePanel = function() {
        return __ui_ClickDelegatePanel.prototype.getFocusablePanel.call.apply(__ui_ClickDelegatePanel.prototype.getFocusablePanel, arguments);
    };
    __ui_ClickDelegatePanel.prototype.__class__.getFocusablePanel.unbound_method = true;
    __ui_ClickDelegatePanel.prototype.getFocusablePanel.instance_method = true;
    __ui_ClickDelegatePanel.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    this.onClick(this, event);
    }
    else if ((type == 'keydown')) {
    var modifiers = ui_KeyboardListener().getKeyboardModifiers(event);
    if (pyjslib_hasattr(this.keyDelegate, 'onKeyDown')) {
    this.keyDelegate.onKeyDown(this, DOM_eventGetKeyCode(event), modifiers);
    }
    }
    };
    __ui_ClickDelegatePanel.prototype.__class__.onBrowserEvent = function() {
        return __ui_ClickDelegatePanel.prototype.onBrowserEvent.call.apply(__ui_ClickDelegatePanel.prototype.onBrowserEvent, arguments);
    };
    __ui_ClickDelegatePanel.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_ClickDelegatePanel.prototype.onBrowserEvent.instance_method = true;
}
function __ui_TabBar() {
}
function ui_TabBar() {
    var instance = new __ui_TabBar();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TabBar_initialize() {
    if(__ui_TabBar.__was_initialized__) return;
    __ui_TabBar.__was_initialized__ = true;
    if(!__ui_Composite.__was_initialized__)
        __ui_Composite_initialize();
    pyjs_extend(__ui_TabBar, __ui_Composite);
    __ui_TabBar.prototype.__class__.__new__ = ui_TabBar;
    __ui_TabBar.prototype.__class__.STYLENAME_DEFAULT = 'gwt-TabBarItem';
    __ui_TabBar.prototype.__init__ = function() {
    __ui_Composite.prototype.__class__.__init__(this);
    this.panel = ui_HorizontalPanel();
    this.selectedTab = null;
    this.tabListeners = new pyjslib_List([]);
    this.initWidget(this.panel);
    this.sinkEvents(__ui_Event.prototype.__class__.ONCLICK);
    this.setStyleName('gwt-TabBar');
    this.panel.setVerticalAlignment(__ui_HasAlignment.prototype.__class__.ALIGN_BOTTOM);
    var first = ui_HTML('&nbsp;', true);
    var rest = ui_HTML('&nbsp;', true);
    first.setStyleName('gwt-TabBarFirst');
    rest.setStyleName('gwt-TabBarRest');
    first.setHeight('100%');
    rest.setHeight('100%');
    this.panel.add(first);
    this.panel.add(rest);
    first.setHeight('100%');
    this.panel.setCellHeight(first, '100%');
    this.panel.setCellWidth(rest, '100%');
    };
    __ui_TabBar.prototype.__class__.__init__ = function() {
        return __ui_TabBar.prototype.__init__.call.apply(__ui_TabBar.prototype.__init__, arguments);
    };
    __ui_TabBar.prototype.__class__.__init__.unbound_method = true;
    __ui_TabBar.prototype.__init__.instance_method = true;
    __ui_TabBar.prototype.addTab = function(text, asHTML) {
    if (typeof asHTML == 'undefined') asHTML=false;
    this.insertTab(text, asHTML, this.getTabCount());
    };
__ui_TabBar.prototype.addTab.parse_kwargs = function ( __kwargs, text, asHTML ) {
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [text, asHTML];
    return __r;
};
    __ui_TabBar.prototype.__class__.addTab = function() {
        return __ui_TabBar.prototype.addTab.call.apply(__ui_TabBar.prototype.addTab, arguments);
    };
    __ui_TabBar.prototype.__class__.addTab.unbound_method = true;
    __ui_TabBar.prototype.addTab.instance_method = true;
    __ui_TabBar.prototype.__class__.addTab.parse_kwargs = __ui_TabBar.prototype.addTab.parse_kwargs;
    __ui_TabBar.prototype.addTabListener = function(listener) {
    this.tabListeners.append(listener);
    };
    __ui_TabBar.prototype.__class__.addTabListener = function() {
        return __ui_TabBar.prototype.addTabListener.call.apply(__ui_TabBar.prototype.addTabListener, arguments);
    };
    __ui_TabBar.prototype.__class__.addTabListener.unbound_method = true;
    __ui_TabBar.prototype.addTabListener.instance_method = true;
    __ui_TabBar.prototype.getSelectedTab = function() {
    if ((this.selectedTab == null)) {
    return -1;
    }
    return  ( this.panel.getWidgetIndex(this.selectedTab) - 1 ) ;
    };
    __ui_TabBar.prototype.__class__.getSelectedTab = function() {
        return __ui_TabBar.prototype.getSelectedTab.call.apply(__ui_TabBar.prototype.getSelectedTab, arguments);
    };
    __ui_TabBar.prototype.__class__.getSelectedTab.unbound_method = true;
    __ui_TabBar.prototype.getSelectedTab.instance_method = true;
    __ui_TabBar.prototype.getTabCount = function() {
    return  ( this.panel.getWidgetCount() - 2 ) ;
    };
    __ui_TabBar.prototype.__class__.getTabCount = function() {
        return __ui_TabBar.prototype.getTabCount.call.apply(__ui_TabBar.prototype.getTabCount, arguments);
    };
    __ui_TabBar.prototype.__class__.getTabCount.unbound_method = true;
    __ui_TabBar.prototype.getTabCount.instance_method = true;
    __ui_TabBar.prototype.getTabHTML = function(index) {
    if ((index >= this.getTabCount())) {
    return;
    }
    var delPanel = this.panel.getWidget( ( index + 1 ) );
    var focusablePanel = delPanel.getFocusablePanel();
    var widget = focusablePanel.getWidget();
    if (pyjslib_hasattr(widget, 'getHTML')) {
    return widget.getHTML();
    }
    else if (pyjslib_hasattr(widget, 'getText')) {
    return widget.getText();
    }
    else {
    var fpe = DOM_getParent(this.focusablePanel.getElement());
    return DOM_getInnerHTML(fpe);
    }
    };
    __ui_TabBar.prototype.__class__.getTabHTML = function() {
        return __ui_TabBar.prototype.getTabHTML.call.apply(__ui_TabBar.prototype.getTabHTML, arguments);
    };
    __ui_TabBar.prototype.__class__.getTabHTML.unbound_method = true;
    __ui_TabBar.prototype.getTabHTML.instance_method = true;
    __ui_TabBar.prototype.createTabTextWrapper = function() {
    return;
    };
    __ui_TabBar.prototype.__class__.createTabTextWrapper = function() {
        return __ui_TabBar.prototype.createTabTextWrapper.call.apply(__ui_TabBar.prototype.createTabTextWrapper, arguments);
    };
    __ui_TabBar.prototype.__class__.createTabTextWrapper.unbound_method = true;
    __ui_TabBar.prototype.createTabTextWrapper.instance_method = true;
    __ui_TabBar.prototype.insertTab = function(text, asHTML, beforeIndex) {
    if (typeof beforeIndex == 'undefined') beforeIndex=null;
    if ((beforeIndex == null)) {
    var beforeIndex = asHTML;
    var asHTML = false;
    }
    if (((beforeIndex < 0)) || ((beforeIndex > this.getTabCount()))) {
    }
    if (pyjslib_isString(text)) {
    if (asHTML) {
    var item = ui_HTML(text);
    }
    else {
    var item = ui_Label(text);
    }
    item.setWordWrap(false);
    }
    else {
    var item = text;
    }
    this.insertTabWidget(item, beforeIndex);
    };
__ui_TabBar.prototype.insertTab.parse_kwargs = function ( __kwargs, text, asHTML, beforeIndex ) {
    if (typeof beforeIndex == 'undefined')
        beforeIndex=__kwargs.beforeIndex;
    var __r = [text, asHTML, beforeIndex];
    return __r;
};
    __ui_TabBar.prototype.__class__.insertTab = function() {
        return __ui_TabBar.prototype.insertTab.call.apply(__ui_TabBar.prototype.insertTab, arguments);
    };
    __ui_TabBar.prototype.__class__.insertTab.unbound_method = true;
    __ui_TabBar.prototype.insertTab.instance_method = true;
    __ui_TabBar.prototype.__class__.insertTab.parse_kwargs = __ui_TabBar.prototype.insertTab.parse_kwargs;
    __ui_TabBar.prototype.insertTabWidget = function(widget, beforeIndex) {
    var delWidget = ui_ClickDelegatePanel(this, widget, this, this);
    delWidget.setStyleName(this.STYLENAME_DEFAULT);
    var focusablePanel = delWidget.getFocusablePanel();
    this.panel.insert(delWidget,  ( beforeIndex + 1 ) );
    this.setStyleName(DOM_getParent(delWidget.getElement()),  ( this.STYLENAME_DEFAULT + '-wrapper' ) , true);
    };
    __ui_TabBar.prototype.__class__.insertTabWidget = function() {
        return __ui_TabBar.prototype.insertTabWidget.call.apply(__ui_TabBar.prototype.insertTabWidget, arguments);
    };
    __ui_TabBar.prototype.__class__.insertTabWidget.unbound_method = true;
    __ui_TabBar.prototype.insertTabWidget.instance_method = true;
    __ui_TabBar.prototype.onClick = function(sender) {

        var __i = pyjslib_range(1,  ( this.panel.getWidgetCount() - 1 ) ).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    if ((this.panel.getWidget(i) == sender)) {
    return this.selectTab( ( i - 1 ) );
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return false;
    };
    __ui_TabBar.prototype.__class__.onClick = function() {
        return __ui_TabBar.prototype.onClick.call.apply(__ui_TabBar.prototype.onClick, arguments);
    };
    __ui_TabBar.prototype.__class__.onClick.unbound_method = true;
    __ui_TabBar.prototype.onClick.instance_method = true;
    __ui_TabBar.prototype.removeTab = function(index) {
    this.checkTabIndex(index);
    var toRemove = this.panel.getWidget( ( index + 1 ) );
    if ((toRemove == this.selectedTab)) {
    this.selectedTab = null;
    }
    this.panel.remove(toRemove);
    };
    __ui_TabBar.prototype.__class__.removeTab = function() {
        return __ui_TabBar.prototype.removeTab.call.apply(__ui_TabBar.prototype.removeTab, arguments);
    };
    __ui_TabBar.prototype.__class__.removeTab.unbound_method = true;
    __ui_TabBar.prototype.removeTab.instance_method = true;
    __ui_TabBar.prototype.removeTabListener = function(listener) {
    this.tabListeners.remove(listener);
    };
    __ui_TabBar.prototype.__class__.removeTabListener = function() {
        return __ui_TabBar.prototype.removeTabListener.call.apply(__ui_TabBar.prototype.removeTabListener, arguments);
    };
    __ui_TabBar.prototype.__class__.removeTabListener.unbound_method = true;
    __ui_TabBar.prototype.removeTabListener.instance_method = true;
    __ui_TabBar.prototype.selectTab = function(index) {
    this.checkTabIndex(index);

        var __listener = this.tabListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (!(listener.onBeforeTabSelected(this, index))) {
    return false;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    this.setSelectionStyle(this.selectedTab, false);
    if ((index == -1)) {
    this.selectedTab = null;
    return true;
    }
    this.selectedTab = this.panel.getWidget( ( index + 1 ) );
    this.setSelectionStyle(this.selectedTab, true);

        var __listener = this.tabListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onTabSelected(this, index);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return true;
    };
    __ui_TabBar.prototype.__class__.selectTab = function() {
        return __ui_TabBar.prototype.selectTab.call.apply(__ui_TabBar.prototype.selectTab, arguments);
    };
    __ui_TabBar.prototype.__class__.selectTab.unbound_method = true;
    __ui_TabBar.prototype.selectTab.instance_method = true;
    __ui_TabBar.prototype.checkTabIndex = function(index) {
    if (((index < -1)) || ((index >= this.getTabCount()))) {
    }
    };
    __ui_TabBar.prototype.__class__.checkTabIndex = function() {
        return __ui_TabBar.prototype.checkTabIndex.call.apply(__ui_TabBar.prototype.checkTabIndex, arguments);
    };
    __ui_TabBar.prototype.__class__.checkTabIndex.unbound_method = true;
    __ui_TabBar.prototype.checkTabIndex.instance_method = true;
    __ui_TabBar.prototype.setSelectionStyle = function(item, selected) {
    if ((item != null)) {
    if (selected) {
    item.addStyleName('gwt-TabBarItem-selected');
    this.setStyleName(DOM_getParent(item.getElement()), 'gwt-TabBarItem-wrapper-selected', true);
    }
    else {
    item.removeStyleName('gwt-TabBarItem-selected');
    this.setStyleName(DOM_getParent(item.getElement()), 'gwt-TabBarItem-wrapper-selected', false);
    }
    }
    };
    __ui_TabBar.prototype.__class__.setSelectionStyle = function() {
        return __ui_TabBar.prototype.setSelectionStyle.call.apply(__ui_TabBar.prototype.setSelectionStyle, arguments);
    };
    __ui_TabBar.prototype.__class__.setSelectionStyle.unbound_method = true;
    __ui_TabBar.prototype.setSelectionStyle.instance_method = true;
}
function __ui_TabPanel() {
}
function ui_TabPanel(tabBar) {
    if (typeof tabBar == 'undefined') tabBar=null;
    var instance = new __ui_TabPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_TabPanel.parse_kwargs = function ( __kwargs, tabBar ) {
    if (typeof tabBar == 'undefined')
        tabBar=__kwargs.tabBar;
    var __r = [tabBar];
    return __r;
};
function __ui_TabPanel_initialize() {
    if(__ui_TabPanel.__was_initialized__) return;
    __ui_TabPanel.__was_initialized__ = true;
    if(!__ui_Composite.__was_initialized__)
        __ui_Composite_initialize();
    pyjs_extend(__ui_TabPanel, __ui_Composite);
    __ui_TabPanel.prototype.__class__.__new__ = ui_TabPanel;
    __ui_TabPanel.prototype.__init__ = function(tabBar) {
    if (typeof tabBar == 'undefined') tabBar=null;
    __ui_Composite.prototype.__class__.__init__(this);
    this.tab_children = new pyjslib_List([]);
    this.deck = ui_DeckPanel();
    if ((tabBar == null)) {
    this.tabBar = ui_TabBar();
    }
    else {
    this.tabBar = tabBar;
    }
    this.tabListeners = new pyjslib_List([]);
    var panel = ui_VerticalPanel();
    panel.add(this.tabBar);
    panel.add(this.deck);
    panel.setCellHeight(this.deck, '100%');
    this.tabBar.setWidth('100%');
    this.tabBar.addTabListener(this);
    this.initWidget(panel);
    this.setStyleName('gwt-TabPanel');
    this.deck.setStyleName('gwt-TabPanelBottom');
    };
__ui_TabPanel.prototype.__init__.parse_kwargs = function ( __kwargs, tabBar ) {
    if (typeof tabBar == 'undefined')
        tabBar=__kwargs.tabBar;
    var __r = [tabBar];
    return __r;
};
    __ui_TabPanel.prototype.__class__.__init__ = function() {
        return __ui_TabPanel.prototype.__init__.call.apply(__ui_TabPanel.prototype.__init__, arguments);
    };
    __ui_TabPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_TabPanel.prototype.__init__.instance_method = true;
    __ui_TabPanel.prototype.__class__.__init__.parse_kwargs = __ui_TabPanel.prototype.__init__.parse_kwargs;
    __ui_TabPanel.prototype.add = function(widget, tabText, asHTML) {
    if (typeof tabText == 'undefined') tabText=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    if ((tabText == null)) {
    console.error('A tabText parameter must be specified with add().');
    }
    this.insert(widget, tabText, asHTML, this.getWidgetCount());
    };
__ui_TabPanel.prototype.add.parse_kwargs = function ( __kwargs, widget, tabText, asHTML ) {
    if (typeof tabText == 'undefined')
        tabText=__kwargs.tabText;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [widget, tabText, asHTML];
    return __r;
};
    __ui_TabPanel.prototype.__class__.add = function() {
        return __ui_TabPanel.prototype.add.call.apply(__ui_TabPanel.prototype.add, arguments);
    };
    __ui_TabPanel.prototype.__class__.add.unbound_method = true;
    __ui_TabPanel.prototype.add.instance_method = true;
    __ui_TabPanel.prototype.__class__.add.parse_kwargs = __ui_TabPanel.prototype.add.parse_kwargs;
    __ui_TabPanel.prototype.addTabListener = function(listener) {
    this.tabListeners.append(listener);
    };
    __ui_TabPanel.prototype.__class__.addTabListener = function() {
        return __ui_TabPanel.prototype.addTabListener.call.apply(__ui_TabPanel.prototype.addTabListener, arguments);
    };
    __ui_TabPanel.prototype.__class__.addTabListener.unbound_method = true;
    __ui_TabPanel.prototype.addTabListener.instance_method = true;
    __ui_TabPanel.prototype.clear = function() {
    while ((this.getWidgetCount() > 0)) {
    this.remove(this.getWidget(0));
    }
    };
    __ui_TabPanel.prototype.__class__.clear = function() {
        return __ui_TabPanel.prototype.clear.call.apply(__ui_TabPanel.prototype.clear, arguments);
    };
    __ui_TabPanel.prototype.__class__.clear.unbound_method = true;
    __ui_TabPanel.prototype.clear.instance_method = true;
    __ui_TabPanel.prototype.getDeckPanel = function() {
    return this.deck;
    };
    __ui_TabPanel.prototype.__class__.getDeckPanel = function() {
        return __ui_TabPanel.prototype.getDeckPanel.call.apply(__ui_TabPanel.prototype.getDeckPanel, arguments);
    };
    __ui_TabPanel.prototype.__class__.getDeckPanel.unbound_method = true;
    __ui_TabPanel.prototype.getDeckPanel.instance_method = true;
    __ui_TabPanel.prototype.getTabBar = function() {
    return this.tabBar;
    };
    __ui_TabPanel.prototype.__class__.getTabBar = function() {
        return __ui_TabPanel.prototype.getTabBar.call.apply(__ui_TabPanel.prototype.getTabBar, arguments);
    };
    __ui_TabPanel.prototype.__class__.getTabBar.unbound_method = true;
    __ui_TabPanel.prototype.getTabBar.instance_method = true;
    __ui_TabPanel.prototype.getWidget = function(index) {
    return this.tab_children.__getitem__(index);
    };
    __ui_TabPanel.prototype.__class__.getWidget = function() {
        return __ui_TabPanel.prototype.getWidget.call.apply(__ui_TabPanel.prototype.getWidget, arguments);
    };
    __ui_TabPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_TabPanel.prototype.getWidget.instance_method = true;
    __ui_TabPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.tab_children);
    };
    __ui_TabPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_TabPanel.prototype.getWidgetCount.call.apply(__ui_TabPanel.prototype.getWidgetCount, arguments);
    };
    __ui_TabPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_TabPanel.prototype.getWidgetCount.instance_method = true;
    __ui_TabPanel.prototype.getWidgetIndex = function(child) {
    return this.tab_children.index(child);
    };
    __ui_TabPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_TabPanel.prototype.getWidgetIndex.call.apply(__ui_TabPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_TabPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_TabPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_TabPanel.prototype.insert = function(widget, tabText, asHTML, beforeIndex) {
    if (typeof beforeIndex == 'undefined') beforeIndex=null;
    if ((beforeIndex == null)) {
    var beforeIndex = asHTML;
    var asHTML = false;
    }
    this.tab_children.insert(beforeIndex, widget);
    this.tabBar.insertTab(tabText, asHTML, beforeIndex);
    this.deck.insert(widget, beforeIndex);
    };
__ui_TabPanel.prototype.insert.parse_kwargs = function ( __kwargs, widget, tabText, asHTML, beforeIndex ) {
    if (typeof beforeIndex == 'undefined')
        beforeIndex=__kwargs.beforeIndex;
    var __r = [widget, tabText, asHTML, beforeIndex];
    return __r;
};
    __ui_TabPanel.prototype.__class__.insert = function() {
        return __ui_TabPanel.prototype.insert.call.apply(__ui_TabPanel.prototype.insert, arguments);
    };
    __ui_TabPanel.prototype.__class__.insert.unbound_method = true;
    __ui_TabPanel.prototype.insert.instance_method = true;
    __ui_TabPanel.prototype.__class__.insert.parse_kwargs = __ui_TabPanel.prototype.insert.parse_kwargs;
    __ui_TabPanel.prototype.__iter__ = function() {
    return this.tab_children.__iter__();
    };
    __ui_TabPanel.prototype.__class__.__iter__ = function() {
        return __ui_TabPanel.prototype.__iter__.call.apply(__ui_TabPanel.prototype.__iter__, arguments);
    };
    __ui_TabPanel.prototype.__class__.__iter__.unbound_method = true;
    __ui_TabPanel.prototype.__iter__.instance_method = true;
    __ui_TabPanel.prototype.onBeforeTabSelected = function(sender, tabIndex) {

        var __listener = this.tabListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (!(listener.onBeforeTabSelected(sender, tabIndex))) {
    return false;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return true;
    };
    __ui_TabPanel.prototype.__class__.onBeforeTabSelected = function() {
        return __ui_TabPanel.prototype.onBeforeTabSelected.call.apply(__ui_TabPanel.prototype.onBeforeTabSelected, arguments);
    };
    __ui_TabPanel.prototype.__class__.onBeforeTabSelected.unbound_method = true;
    __ui_TabPanel.prototype.onBeforeTabSelected.instance_method = true;
    __ui_TabPanel.prototype.onTabSelected = function(sender, tabIndex) {
    this.deck.showWidget(tabIndex);

        var __listener = this.tabListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onTabSelected(sender, tabIndex);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_TabPanel.prototype.__class__.onTabSelected = function() {
        return __ui_TabPanel.prototype.onTabSelected.call.apply(__ui_TabPanel.prototype.onTabSelected, arguments);
    };
    __ui_TabPanel.prototype.__class__.onTabSelected.unbound_method = true;
    __ui_TabPanel.prototype.onTabSelected.instance_method = true;
    __ui_TabPanel.prototype.remove = function(widget) {
    if (pyjslib_isNumber(widget)) {
    var widget = this.getWidget(widget);
    }
    var index = this.getWidgetIndex(widget);
    if ((index == -1)) {
    return false;
    }
    this.tab_children.remove(widget);
    this.tabBar.removeTab(index);
    this.deck.remove(widget);
    return true;
    };
    __ui_TabPanel.prototype.__class__.remove = function() {
        return __ui_TabPanel.prototype.remove.call.apply(__ui_TabPanel.prototype.remove, arguments);
    };
    __ui_TabPanel.prototype.__class__.remove.unbound_method = true;
    __ui_TabPanel.prototype.remove.instance_method = true;
    __ui_TabPanel.prototype.removeTabListener = function(listener) {
    this.tabListeners.remove(listener);
    };
    __ui_TabPanel.prototype.__class__.removeTabListener = function() {
        return __ui_TabPanel.prototype.removeTabListener.call.apply(__ui_TabPanel.prototype.removeTabListener, arguments);
    };
    __ui_TabPanel.prototype.__class__.removeTabListener.unbound_method = true;
    __ui_TabPanel.prototype.removeTabListener.instance_method = true;
    __ui_TabPanel.prototype.selectTab = function(index) {
    this.tabBar.selectTab(index);
    };
    __ui_TabPanel.prototype.__class__.selectTab = function() {
        return __ui_TabPanel.prototype.selectTab.call.apply(__ui_TabPanel.prototype.selectTab, arguments);
    };
    __ui_TabPanel.prototype.__class__.selectTab.unbound_method = true;
    __ui_TabPanel.prototype.selectTab.instance_method = true;
}
function __ui_StackPanel() {
}
function ui_StackPanel() {
    var instance = new __ui_StackPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_StackPanel_initialize() {
    if(__ui_StackPanel.__was_initialized__) return;
    __ui_StackPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_StackPanel, __ui_ComplexPanel);
    __ui_StackPanel.prototype.__class__.__new__ = ui_StackPanel;
    __ui_StackPanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.body = null;
    this.visibleStack = -1;
    var table = DOM_createTable();
    this.setElement(table);
    this.body = DOM_createTBody();
    DOM_appendChild(table, this.body);
    DOM_setIntAttribute(table, 'cellSpacing', 0);
    DOM_setIntAttribute(table, 'cellPadding', 0);
    DOM_sinkEvents(table, __ui_Event.prototype.__class__.ONCLICK);
    this.setStyleName('gwt-StackPanel');
    };
    __ui_StackPanel.prototype.__class__.__init__ = function() {
        return __ui_StackPanel.prototype.__init__.call.apply(__ui_StackPanel.prototype.__init__, arguments);
    };
    __ui_StackPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_StackPanel.prototype.__init__.instance_method = true;
    __ui_StackPanel.prototype.add = function(widget, stackText, asHTML) {
    if (typeof stackText == 'undefined') stackText='';
    if (typeof asHTML == 'undefined') asHTML=false;
    widget.removeFromParent();
    var index = this.getWidgetCount();
    var tr = DOM_createTR();
    var td = DOM_createTD();
    DOM_appendChild(this.body, tr);
    DOM_appendChild(tr, td);
    this.setStyleName(td, 'gwt-StackPanelItem', true);
    DOM_setIntAttribute(td, '__index', index);
    DOM_setAttribute(td, 'height', '1px');
    var tr = DOM_createTR();
    var td = DOM_createTD();
    DOM_appendChild(this.body, tr);
    DOM_appendChild(tr, td);
    DOM_setAttribute(td, 'height', '100%');
    DOM_setAttribute(td, 'vAlign', 'top');
    __ui_ComplexPanel.prototype.__class__.add(this, widget, td);
    this.setStackVisible(index, false);
    if ((this.visibleStack == -1)) {
    this.showStack(0);
    }
    if ((stackText != '')) {
    this.setStackText( ( this.getWidgetCount() - 1 ) , stackText, asHTML);
    }
    };
__ui_StackPanel.prototype.add.parse_kwargs = function ( __kwargs, widget, stackText, asHTML ) {
    if (typeof stackText == 'undefined')
        stackText=__kwargs.stackText;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [widget, stackText, asHTML];
    return __r;
};
    __ui_StackPanel.prototype.__class__.add = function() {
        return __ui_StackPanel.prototype.add.call.apply(__ui_StackPanel.prototype.add, arguments);
    };
    __ui_StackPanel.prototype.__class__.add.unbound_method = true;
    __ui_StackPanel.prototype.add.instance_method = true;
    __ui_StackPanel.prototype.__class__.add.parse_kwargs = __ui_StackPanel.prototype.add.parse_kwargs;
    __ui_StackPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_StackPanel.prototype.__class__.getWidget = function() {
        return __ui_StackPanel.prototype.getWidget.call.apply(__ui_StackPanel.prototype.getWidget, arguments);
    };
    __ui_StackPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_StackPanel.prototype.getWidget.instance_method = true;
    __ui_StackPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_StackPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_StackPanel.prototype.getWidgetCount.call.apply(__ui_StackPanel.prototype.getWidgetCount, arguments);
    };
    __ui_StackPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_StackPanel.prototype.getWidgetCount.instance_method = true;
    __ui_StackPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_StackPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_StackPanel.prototype.getWidgetIndex.call.apply(__ui_StackPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_StackPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_StackPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_StackPanel.prototype.onBrowserEvent = function(event) {
    if ((DOM_eventGetType(event) == 'click')) {
    var index = this.getDividerIndex(DOM_eventGetTarget(event));
    if ((index != -1)) {
    this.showStack(index);
    }
    }
    };
    __ui_StackPanel.prototype.__class__.onBrowserEvent = function() {
        return __ui_StackPanel.prototype.onBrowserEvent.call.apply(__ui_StackPanel.prototype.onBrowserEvent, arguments);
    };
    __ui_StackPanel.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_StackPanel.prototype.onBrowserEvent.instance_method = true;
    __ui_StackPanel.prototype.remove = function(child, index) {
    if (typeof index == 'undefined') index=null;
    if ((index == null)) {
    if (pyjslib_isNumber(child)) {
    var index = child;
    var child = this.getWidget(child);
    }
    else {
    var index = this.getWidgetIndex(child);
    }
    }
    if ((child.getParent() != this)) {
    return false;
    }
    if ((this.visibleStack == index)) {
    this.visibleStack = -1;
    }
    else if ((this.visibleStack > index)) {
    this.visibleStack -= 1;
    }
    var rowIndex =  ( 2 * index ) ;
    var tr = DOM_getChild(this.body, rowIndex);
    DOM_removeChild(this.body, tr);
    var tr = DOM_getChild(this.body, rowIndex);
    DOM_removeChild(this.body, tr);
    __ui_ComplexPanel.prototype.__class__.remove(this, child);
    var rows =  ( this.getWidgetCount() * 2 ) ;

        var __i = pyjslib_range(rowIndex, rows, 2).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var childTR = DOM_getChild(this.body, i);
    var td = DOM_getFirstChild(childTR);
    var curIndex = DOM_getIntAttribute(td, '__index');
    DOM_setIntAttribute(td, '__index', index);
    index += 1;

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return true;
    };
__ui_StackPanel.prototype.remove.parse_kwargs = function ( __kwargs, child, index ) {
    if (typeof index == 'undefined')
        index=__kwargs.index;
    var __r = [child, index];
    return __r;
};
    __ui_StackPanel.prototype.__class__.remove = function() {
        return __ui_StackPanel.prototype.remove.call.apply(__ui_StackPanel.prototype.remove, arguments);
    };
    __ui_StackPanel.prototype.__class__.remove.unbound_method = true;
    __ui_StackPanel.prototype.remove.instance_method = true;
    __ui_StackPanel.prototype.__class__.remove.parse_kwargs = __ui_StackPanel.prototype.remove.parse_kwargs;
    __ui_StackPanel.prototype.setStackText = function(index, text, asHTML) {
    if (typeof asHTML == 'undefined') asHTML=false;
    if ((index >= this.getWidgetCount())) {
    return;
    }
    var td = DOM_getChild(DOM_getChild(this.body,  ( index * 2 ) ), 0);
    if (asHTML) {
    DOM_setInnerHTML(td, text);
    }
    else {
    DOM_setInnerText(td, text);
    }
    };
__ui_StackPanel.prototype.setStackText.parse_kwargs = function ( __kwargs, index, text, asHTML ) {
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [index, text, asHTML];
    return __r;
};
    __ui_StackPanel.prototype.__class__.setStackText = function() {
        return __ui_StackPanel.prototype.setStackText.call.apply(__ui_StackPanel.prototype.setStackText, arguments);
    };
    __ui_StackPanel.prototype.__class__.setStackText.unbound_method = true;
    __ui_StackPanel.prototype.setStackText.instance_method = true;
    __ui_StackPanel.prototype.__class__.setStackText.parse_kwargs = __ui_StackPanel.prototype.setStackText.parse_kwargs;
    __ui_StackPanel.prototype.showStack = function(index) {
    if (((index >= this.getWidgetCount())) || ((index == this.visibleStack))) {
    return;
    }
    if ((this.visibleStack >= 0)) {
    this.setStackVisible(this.visibleStack, false);
    }
    this.visibleStack = index;
    this.setStackVisible(this.visibleStack, true);
    };
    __ui_StackPanel.prototype.__class__.showStack = function() {
        return __ui_StackPanel.prototype.showStack.call.apply(__ui_StackPanel.prototype.showStack, arguments);
    };
    __ui_StackPanel.prototype.__class__.showStack.unbound_method = true;
    __ui_StackPanel.prototype.showStack.instance_method = true;
    __ui_StackPanel.prototype.getDividerIndex = function(elem) {
    while (((elem != null)) && (!(DOM_compare(elem, this.getElement())))) {
    var expando = DOM_getAttribute(elem, '__index');
    if ((expando != null)) {
    return pyjslib_int(expando);
    }
    var elem = DOM_getParent(elem);
    }
    return -1;
    };
    __ui_StackPanel.prototype.__class__.getDividerIndex = function() {
        return __ui_StackPanel.prototype.getDividerIndex.call.apply(__ui_StackPanel.prototype.getDividerIndex, arguments);
    };
    __ui_StackPanel.prototype.__class__.getDividerIndex.unbound_method = true;
    __ui_StackPanel.prototype.getDividerIndex.instance_method = true;
    __ui_StackPanel.prototype.setStackVisible = function(index, visible) {
    var tr = DOM_getChild(this.body,  ( index * 2 ) );
    if ((tr == null)) {
    return;
    }
    var td = DOM_getFirstChild(tr);
    this.setStyleName(td, 'gwt-StackPanelItem-selected', visible);
    var tr = DOM_getChild(this.body,  (  ( index * 2 )  + 1 ) );
    this.setVisible(tr, visible);
    this.getWidget(index).setVisible(visible);
    };
    __ui_StackPanel.prototype.__class__.setStackVisible = function() {
        return __ui_StackPanel.prototype.setStackVisible.call.apply(__ui_StackPanel.prototype.setStackVisible, arguments);
    };
    __ui_StackPanel.prototype.__class__.setStackVisible.unbound_method = true;
    __ui_StackPanel.prototype.setStackVisible.instance_method = true;
    __ui_StackPanel.prototype.getSelectedIndex = function() {
    return this.visibleStack;
    };
    __ui_StackPanel.prototype.__class__.getSelectedIndex = function() {
        return __ui_StackPanel.prototype.getSelectedIndex.call.apply(__ui_StackPanel.prototype.getSelectedIndex, arguments);
    };
    __ui_StackPanel.prototype.__class__.getSelectedIndex.unbound_method = true;
    __ui_StackPanel.prototype.getSelectedIndex.instance_method = true;
}
function __ui_TextBoxBase() {
}
function ui_TextBoxBase(element) {
    var instance = new __ui_TextBoxBase();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TextBoxBase_initialize() {
    if(__ui_TextBoxBase.__was_initialized__) return;
    __ui_TextBoxBase.__was_initialized__ = true;
    if(!__ui_FocusWidget.__was_initialized__)
        __ui_FocusWidget_initialize();
    pyjs_extend(__ui_TextBoxBase, __ui_FocusWidget);
    __ui_TextBoxBase.prototype.__class__.__new__ = ui_TextBoxBase;
    __ui_TextBoxBase.prototype.__class__.ALIGN_CENTER = 'center';
    __ui_TextBoxBase.prototype.__class__.ALIGN_JUSTIFY = 'justify';
    __ui_TextBoxBase.prototype.__class__.ALIGN_LEFT = 'left';
    __ui_TextBoxBase.prototype.__class__.ALIGN_RIGHT = 'right';
    __ui_TextBoxBase.prototype.__init__ = function(element) {
    this.changeListeners = new pyjslib_List([]);
    this.clickListeners = new pyjslib_List([]);
    this.currentEvent = null;
    this.keyboardListeners = new pyjslib_List([]);
    __ui_FocusWidget.prototype.__class__.__init__(this, element);
    this.sinkEvents(__ui_Event.prototype.__class__.ONCHANGE);
    };
    __ui_TextBoxBase.prototype.__class__.__init__ = function() {
        return __ui_TextBoxBase.prototype.__init__.call.apply(__ui_TextBoxBase.prototype.__init__, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.__init__.unbound_method = true;
    __ui_TextBoxBase.prototype.__init__.instance_method = true;
    __ui_TextBoxBase.prototype.addChangeListener = function(listener) {
    this.changeListeners.append(listener);
    };
    __ui_TextBoxBase.prototype.__class__.addChangeListener = function() {
        return __ui_TextBoxBase.prototype.addChangeListener.call.apply(__ui_TextBoxBase.prototype.addChangeListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.addChangeListener.unbound_method = true;
    __ui_TextBoxBase.prototype.addChangeListener.instance_method = true;
    __ui_TextBoxBase.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_TextBoxBase.prototype.__class__.addClickListener = function() {
        return __ui_TextBoxBase.prototype.addClickListener.call.apply(__ui_TextBoxBase.prototype.addClickListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.addClickListener.unbound_method = true;
    __ui_TextBoxBase.prototype.addClickListener.instance_method = true;
    __ui_TextBoxBase.prototype.addKeyboardListener = function(listener) {
    this.keyboardListeners.append(listener);
    };
    __ui_TextBoxBase.prototype.__class__.addKeyboardListener = function() {
        return __ui_TextBoxBase.prototype.addKeyboardListener.call.apply(__ui_TextBoxBase.prototype.addKeyboardListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.addKeyboardListener.unbound_method = true;
    __ui_TextBoxBase.prototype.addKeyboardListener.instance_method = true;
    __ui_TextBoxBase.prototype.cancelKey = function() {
    if ((this.currentEvent != null)) {
    DOM_eventPreventDefault(this.currentEvent);
    }
    };
    __ui_TextBoxBase.prototype.__class__.cancelKey = function() {
        return __ui_TextBoxBase.prototype.cancelKey.call.apply(__ui_TextBoxBase.prototype.cancelKey, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.cancelKey.unbound_method = true;
    __ui_TextBoxBase.prototype.cancelKey.instance_method = true;
    __ui_TextBoxBase.prototype.getCursorPos = function() {

        try {
            var element = this.getElement()
            return element.selectionStart;
        } catch (e) {
            return 0;
        }
        
    };
    __ui_TextBoxBase.prototype.__class__.getCursorPos = function() {
        return __ui_TextBoxBase.prototype.getCursorPos.call.apply(__ui_TextBoxBase.prototype.getCursorPos, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getCursorPos.unbound_method = true;
    __ui_TextBoxBase.prototype.getCursorPos.instance_method = true;
    __ui_TextBoxBase.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_TextBoxBase.prototype.__class__.getName = function() {
        return __ui_TextBoxBase.prototype.getName.call.apply(__ui_TextBoxBase.prototype.getName, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getName.unbound_method = true;
    __ui_TextBoxBase.prototype.getName.instance_method = true;
    __ui_TextBoxBase.prototype.getSelectedText = function() {
    var start = this.getCursorPos();
    var length = this.getSelectionLength();
    var text = this.getText();
    return pyjslib_slice(text, start,  ( start + length ) );
    };
    __ui_TextBoxBase.prototype.__class__.getSelectedText = function() {
        return __ui_TextBoxBase.prototype.getSelectedText.call.apply(__ui_TextBoxBase.prototype.getSelectedText, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getSelectedText.unbound_method = true;
    __ui_TextBoxBase.prototype.getSelectedText.instance_method = true;
    __ui_TextBoxBase.prototype.getSelectionLength = function() {

        try{
            var element = this.getElement()
            return element.selectionEnd - element.selectionStart;
        } catch (e) {
            return 0;
        }
        
    };
    __ui_TextBoxBase.prototype.__class__.getSelectionLength = function() {
        return __ui_TextBoxBase.prototype.getSelectionLength.call.apply(__ui_TextBoxBase.prototype.getSelectionLength, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getSelectionLength.unbound_method = true;
    __ui_TextBoxBase.prototype.getSelectionLength.instance_method = true;
    __ui_TextBoxBase.prototype.getText = function() {
    return DOM_getAttribute(this.getElement(), 'value');
    };
    __ui_TextBoxBase.prototype.__class__.getText = function() {
        return __ui_TextBoxBase.prototype.getText.call.apply(__ui_TextBoxBase.prototype.getText, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getText.unbound_method = true;
    __ui_TextBoxBase.prototype.getText.instance_method = true;
    __ui_TextBoxBase.prototype.onBrowserEvent = function(event) {
    __ui_FocusWidget.prototype.__class__.onBrowserEvent(this, event);
    var type = DOM_eventGetType(event);
    if ((type == 'change')) {

        var __listener = this.changeListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onChange) {
    listener.onChange(this);
    }
    else {
    listener(this);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_TextBoxBase.prototype.__class__.onBrowserEvent = function() {
        return __ui_TextBoxBase.prototype.onBrowserEvent.call.apply(__ui_TextBoxBase.prototype.onBrowserEvent, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_TextBoxBase.prototype.onBrowserEvent.instance_method = true;
    __ui_TextBoxBase.prototype.removeChangeListener = function(listener) {
    this.changeListeners.remove(listener);
    };
    __ui_TextBoxBase.prototype.__class__.removeChangeListener = function() {
        return __ui_TextBoxBase.prototype.removeChangeListener.call.apply(__ui_TextBoxBase.prototype.removeChangeListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.removeChangeListener.unbound_method = true;
    __ui_TextBoxBase.prototype.removeChangeListener.instance_method = true;
    __ui_TextBoxBase.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_TextBoxBase.prototype.__class__.removeClickListener = function() {
        return __ui_TextBoxBase.prototype.removeClickListener.call.apply(__ui_TextBoxBase.prototype.removeClickListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_TextBoxBase.prototype.removeClickListener.instance_method = true;
    __ui_TextBoxBase.prototype.removeKeyboardListener = function(listener) {
    this.keyboardListeners.remove(listener);
    };
    __ui_TextBoxBase.prototype.__class__.removeKeyboardListener = function() {
        return __ui_TextBoxBase.prototype.removeKeyboardListener.call.apply(__ui_TextBoxBase.prototype.removeKeyboardListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.removeKeyboardListener.unbound_method = true;
    __ui_TextBoxBase.prototype.removeKeyboardListener.instance_method = true;
    __ui_TextBoxBase.prototype.selectAll = function() {
    var length = pyjslib_len(this.getText());
    if ((length > 0)) {
    this.setSelectionRange(0, length);
    }
    };
    __ui_TextBoxBase.prototype.__class__.selectAll = function() {
        return __ui_TextBoxBase.prototype.selectAll.call.apply(__ui_TextBoxBase.prototype.selectAll, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.selectAll.unbound_method = true;
    __ui_TextBoxBase.prototype.selectAll.instance_method = true;
    __ui_TextBoxBase.prototype.setCursorPos = function(pos) {
    this.setSelectionRange(pos, 0);
    };
    __ui_TextBoxBase.prototype.__class__.setCursorPos = function() {
        return __ui_TextBoxBase.prototype.setCursorPos.call.apply(__ui_TextBoxBase.prototype.setCursorPos, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setCursorPos.unbound_method = true;
    __ui_TextBoxBase.prototype.setCursorPos.instance_method = true;
    __ui_TextBoxBase.prototype.setKey = function(key) {
    if ((this.currentEvent != null)) {
    DOM_eventSetKeyCode(this.currentEvent, key);
    }
    };
    __ui_TextBoxBase.prototype.__class__.setKey = function() {
        return __ui_TextBoxBase.prototype.setKey.call.apply(__ui_TextBoxBase.prototype.setKey, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setKey.unbound_method = true;
    __ui_TextBoxBase.prototype.setKey.instance_method = true;
    __ui_TextBoxBase.prototype.setName = function(name) {
    DOM_setAttribute(this.getElement(), 'name', name);
    };
    __ui_TextBoxBase.prototype.__class__.setName = function() {
        return __ui_TextBoxBase.prototype.setName.call.apply(__ui_TextBoxBase.prototype.setName, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setName.unbound_method = true;
    __ui_TextBoxBase.prototype.setName.instance_method = true;
    __ui_TextBoxBase.prototype.setSelectionRange = function(pos, length) {
    if ((length < 0)) {
    console.error( ( 'Length must be a positive integer. Length: ' + length ) );
    }
    if (((pos < 0)) || (( ( length + pos )  > pyjslib_len(this.getText())))) {
    console.error( (  (  (  (  ( 'From Index: ' + pos )  + '  To Index: ' )  +  ( pos + length )  )  + '  Text Length: ' )  + pyjslib_len(this.getText()) ) );
    }
    var element = this.getElement();
    element.setSelectionRange(pos,  ( pos + length ) );
    };
    __ui_TextBoxBase.prototype.__class__.setSelectionRange = function() {
        return __ui_TextBoxBase.prototype.setSelectionRange.call.apply(__ui_TextBoxBase.prototype.setSelectionRange, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setSelectionRange.unbound_method = true;
    __ui_TextBoxBase.prototype.setSelectionRange.instance_method = true;
    __ui_TextBoxBase.prototype.setText = function(text) {
    DOM_setAttribute(this.getElement(), 'value', text);
    };
    __ui_TextBoxBase.prototype.__class__.setText = function() {
        return __ui_TextBoxBase.prototype.setText.call.apply(__ui_TextBoxBase.prototype.setText, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setText.unbound_method = true;
    __ui_TextBoxBase.prototype.setText.instance_method = true;
    __ui_TextBoxBase.prototype.setTextAlignment = function(align) {
    DOM_setStyleAttribute(this.getElement(), 'textAlign', align);
    };
    __ui_TextBoxBase.prototype.__class__.setTextAlignment = function() {
        return __ui_TextBoxBase.prototype.setTextAlignment.call.apply(__ui_TextBoxBase.prototype.setTextAlignment, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setTextAlignment.unbound_method = true;
    __ui_TextBoxBase.prototype.setTextAlignment.instance_method = true;
}
function __ui_TextBox() {
}
function ui_TextBox() {
    var instance = new __ui_TextBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TextBox_initialize() {
    if(__ui_TextBox.__was_initialized__) return;
    __ui_TextBox.__was_initialized__ = true;
    if(!__ui_TextBoxBase.__was_initialized__)
        __ui_TextBoxBase_initialize();
    pyjs_extend(__ui_TextBox, __ui_TextBoxBase);
    __ui_TextBox.prototype.__class__.__new__ = ui_TextBox;
    __ui_TextBox.prototype.__init__ = function() {
    __ui_TextBoxBase.prototype.__class__.__init__(this, DOM_createInputText());
    this.setStyleName('gwt-TextBox');
    };
    __ui_TextBox.prototype.__class__.__init__ = function() {
        return __ui_TextBox.prototype.__init__.call.apply(__ui_TextBox.prototype.__init__, arguments);
    };
    __ui_TextBox.prototype.__class__.__init__.unbound_method = true;
    __ui_TextBox.prototype.__init__.instance_method = true;
    __ui_TextBox.prototype.getMaxLength = function() {
    return DOM_getIntAttribute(this.getElement(), 'maxLength');
    };
    __ui_TextBox.prototype.__class__.getMaxLength = function() {
        return __ui_TextBox.prototype.getMaxLength.call.apply(__ui_TextBox.prototype.getMaxLength, arguments);
    };
    __ui_TextBox.prototype.__class__.getMaxLength.unbound_method = true;
    __ui_TextBox.prototype.getMaxLength.instance_method = true;
    __ui_TextBox.prototype.getVisibleLength = function() {
    return DOM_getIntAttribute(this.getElement(), 'size');
    };
    __ui_TextBox.prototype.__class__.getVisibleLength = function() {
        return __ui_TextBox.prototype.getVisibleLength.call.apply(__ui_TextBox.prototype.getVisibleLength, arguments);
    };
    __ui_TextBox.prototype.__class__.getVisibleLength.unbound_method = true;
    __ui_TextBox.prototype.getVisibleLength.instance_method = true;
    __ui_TextBox.prototype.setMaxLength = function(length) {
    DOM_setIntAttribute(this.getElement(), 'maxLength', length);
    };
    __ui_TextBox.prototype.__class__.setMaxLength = function() {
        return __ui_TextBox.prototype.setMaxLength.call.apply(__ui_TextBox.prototype.setMaxLength, arguments);
    };
    __ui_TextBox.prototype.__class__.setMaxLength.unbound_method = true;
    __ui_TextBox.prototype.setMaxLength.instance_method = true;
    __ui_TextBox.prototype.setVisibleLength = function(length) {
    DOM_setIntAttribute(this.getElement(), 'size', length);
    };
    __ui_TextBox.prototype.__class__.setVisibleLength = function() {
        return __ui_TextBox.prototype.setVisibleLength.call.apply(__ui_TextBox.prototype.setVisibleLength, arguments);
    };
    __ui_TextBox.prototype.__class__.setVisibleLength.unbound_method = true;
    __ui_TextBox.prototype.setVisibleLength.instance_method = true;
}
function __ui_PasswordTextBox() {
}
function ui_PasswordTextBox() {
    var instance = new __ui_PasswordTextBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_PasswordTextBox_initialize() {
    if(__ui_PasswordTextBox.__was_initialized__) return;
    __ui_PasswordTextBox.__was_initialized__ = true;
    if(!__ui_TextBoxBase.__was_initialized__)
        __ui_TextBoxBase_initialize();
    pyjs_extend(__ui_PasswordTextBox, __ui_TextBoxBase);
    __ui_PasswordTextBox.prototype.__class__.__new__ = ui_PasswordTextBox;
    __ui_PasswordTextBox.prototype.__init__ = function() {
    __ui_TextBoxBase.prototype.__class__.__init__(this, DOM_createInputPassword());
    this.setStyleName('gwt-PasswordTextBox');
    };
    __ui_PasswordTextBox.prototype.__class__.__init__ = function() {
        return __ui_PasswordTextBox.prototype.__init__.call.apply(__ui_PasswordTextBox.prototype.__init__, arguments);
    };
    __ui_PasswordTextBox.prototype.__class__.__init__.unbound_method = true;
    __ui_PasswordTextBox.prototype.__init__.instance_method = true;
}
function __ui_TextArea() {
}
function ui_TextArea() {
    var instance = new __ui_TextArea();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TextArea_initialize() {
    if(__ui_TextArea.__was_initialized__) return;
    __ui_TextArea.__was_initialized__ = true;
    if(!__ui_TextBoxBase.__was_initialized__)
        __ui_TextBoxBase_initialize();
    pyjs_extend(__ui_TextArea, __ui_TextBoxBase);
    __ui_TextArea.prototype.__class__.__new__ = ui_TextArea;
    __ui_TextArea.prototype.__init__ = function() {
    __ui_TextBoxBase.prototype.__class__.__init__(this, DOM_createTextArea());
    this.setStyleName('gwt-TextArea');
    };
    __ui_TextArea.prototype.__class__.__init__ = function() {
        return __ui_TextArea.prototype.__init__.call.apply(__ui_TextArea.prototype.__init__, arguments);
    };
    __ui_TextArea.prototype.__class__.__init__.unbound_method = true;
    __ui_TextArea.prototype.__init__.instance_method = true;
    __ui_TextArea.prototype.getCharacterWidth = function() {
    return DOM_getIntAttribute(this.getElement(), 'cols');
    };
    __ui_TextArea.prototype.__class__.getCharacterWidth = function() {
        return __ui_TextArea.prototype.getCharacterWidth.call.apply(__ui_TextArea.prototype.getCharacterWidth, arguments);
    };
    __ui_TextArea.prototype.__class__.getCharacterWidth.unbound_method = true;
    __ui_TextArea.prototype.getCharacterWidth.instance_method = true;
    __ui_TextArea.prototype.getCursorPos = function() {
    return __ui_TextBoxBase.prototype.__class__.getCursorPos(this);
    };
    __ui_TextArea.prototype.__class__.getCursorPos = function() {
        return __ui_TextArea.prototype.getCursorPos.call.apply(__ui_TextArea.prototype.getCursorPos, arguments);
    };
    __ui_TextArea.prototype.__class__.getCursorPos.unbound_method = true;
    __ui_TextArea.prototype.getCursorPos.instance_method = true;
    __ui_TextArea.prototype.getVisibleLines = function() {
    return DOM_getIntAttribute(this.getElement(), 'rows');
    };
    __ui_TextArea.prototype.__class__.getVisibleLines = function() {
        return __ui_TextArea.prototype.getVisibleLines.call.apply(__ui_TextArea.prototype.getVisibleLines, arguments);
    };
    __ui_TextArea.prototype.__class__.getVisibleLines.unbound_method = true;
    __ui_TextArea.prototype.getVisibleLines.instance_method = true;
    __ui_TextArea.prototype.setCharacterWidth = function(width) {
    DOM_setIntAttribute(this.getElement(), 'cols', width);
    };
    __ui_TextArea.prototype.__class__.setCharacterWidth = function() {
        return __ui_TextArea.prototype.setCharacterWidth.call.apply(__ui_TextArea.prototype.setCharacterWidth, arguments);
    };
    __ui_TextArea.prototype.__class__.setCharacterWidth.unbound_method = true;
    __ui_TextArea.prototype.setCharacterWidth.instance_method = true;
    __ui_TextArea.prototype.setVisibleLines = function(lines) {
    DOM_setIntAttribute(this.getElement(), 'rows', lines);
    };
    __ui_TextArea.prototype.__class__.setVisibleLines = function() {
        return __ui_TextArea.prototype.setVisibleLines.call.apply(__ui_TextArea.prototype.setVisibleLines, arguments);
    };
    __ui_TextArea.prototype.__class__.setVisibleLines.unbound_method = true;
    __ui_TextArea.prototype.setVisibleLines.instance_method = true;
}
function __ui_TreeContentPanel() {
}
function ui_TreeContentPanel(element) {
    var instance = new __ui_TreeContentPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TreeContentPanel_initialize() {
    if(__ui_TreeContentPanel.__was_initialized__) return;
    __ui_TreeContentPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_TreeContentPanel, __ui_SimplePanel);
    __ui_TreeContentPanel.prototype.__class__.__new__ = ui_TreeContentPanel;
    __ui_TreeContentPanel.prototype.__init__ = function(element) {
    __ui_SimplePanel.prototype.__class__.__init__(this, element);
    this.tree_item = null;
    };
    __ui_TreeContentPanel.prototype.__class__.__init__ = function() {
        return __ui_TreeContentPanel.prototype.__init__.call.apply(__ui_TreeContentPanel.prototype.__init__, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_TreeContentPanel.prototype.__init__.instance_method = true;
    __ui_TreeContentPanel.prototype.getTreeItem = function() {
    return this.tree_item;
    };
    __ui_TreeContentPanel.prototype.__class__.getTreeItem = function() {
        return __ui_TreeContentPanel.prototype.getTreeItem.call.apply(__ui_TreeContentPanel.prototype.getTreeItem, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.getTreeItem.unbound_method = true;
    __ui_TreeContentPanel.prototype.getTreeItem.instance_method = true;
    __ui_TreeContentPanel.prototype.setTreeItem = function(tree_item) {
    this.tree_item = tree_item;
    };
    __ui_TreeContentPanel.prototype.__class__.setTreeItem = function() {
        return __ui_TreeContentPanel.prototype.setTreeItem.call.apply(__ui_TreeContentPanel.prototype.setTreeItem, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.setTreeItem.unbound_method = true;
    __ui_TreeContentPanel.prototype.setTreeItem.instance_method = true;
    __ui_TreeContentPanel.prototype.setParent = function(widget) {
    console.error('Cannot directly setParent on a WidgetTreeItem\'s ContentPanel');
    };
    __ui_TreeContentPanel.prototype.__class__.setParent = function() {
        return __ui_TreeContentPanel.prototype.setParent.call.apply(__ui_TreeContentPanel.prototype.setParent, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.setParent.unbound_method = true;
    __ui_TreeContentPanel.prototype.setParent.instance_method = true;
    __ui_TreeContentPanel.prototype.treeSetParent = function(widget) {
    __ui_SimplePanel.prototype.__class__.setParent(this, widget);
    };
    __ui_TreeContentPanel.prototype.__class__.treeSetParent = function() {
        return __ui_TreeContentPanel.prototype.treeSetParent.call.apply(__ui_TreeContentPanel.prototype.treeSetParent, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.treeSetParent.unbound_method = true;
    __ui_TreeContentPanel.prototype.treeSetParent.instance_method = true;
}
function __ui_TreeItem() {
}
function ui_TreeItem(html) {
    if (typeof html == 'undefined') html=null;
    var instance = new __ui_TreeItem();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_TreeItem.parse_kwargs = function ( __kwargs, html ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    var __r = [html];
    return __r;
};
function __ui_TreeItem_initialize() {
    if(__ui_TreeItem.__was_initialized__) return;
    __ui_TreeItem.__was_initialized__ = true;
    if(!__ui_UIObject.__was_initialized__)
        __ui_UIObject_initialize();
    pyjs_extend(__ui_TreeItem, __ui_UIObject);
    __ui_TreeItem.prototype.__class__.__new__ = ui_TreeItem;
    __ui_TreeItem.prototype.__init__ = function(html) {
    if (typeof html == 'undefined') html=null;
    this.children = new pyjslib_List([]);
    this.contentPanel = null;
    this.itemTable = null;
    this.contentElem = null;
    this.imgElem = null;
    this.childSpanElem = null;
    this.open = false;
    this.parent = null;
    this.selected = false;
    this.tree = null;
    this.userObject = null;
    this.setElement(DOM_createDiv());
    this.itemTable = DOM_createTable();
    this.contentElem = DOM_createSpan();
    this.childSpanElem = DOM_createSpan();
    this.imgElem = DOM_createImg();
    var tbody = DOM_createTBody();
    var tr = DOM_createTR();
    var tdImg = DOM_createTD();
    var tdContent = DOM_createTD();
    DOM_appendChild(this.itemTable, tbody);
    DOM_appendChild(tbody, tr);
    DOM_appendChild(tr, tdImg);
    DOM_appendChild(tr, tdContent);
    DOM_setStyleAttribute(tdImg, 'verticalAlign', 'middle');
    DOM_setStyleAttribute(tdContent, 'verticalAlign', 'middle');
    DOM_setStyleAttribute(this.getElement(), 'cursor', 'pointer');
    DOM_appendChild(this.getElement(), this.itemTable);
    DOM_appendChild(this.getElement(), this.childSpanElem);
    DOM_appendChild(tdImg, this.imgElem);
    DOM_appendChild(tdContent, this.contentElem);
    DOM_setAttribute(this.getElement(), 'position', 'relative');
    DOM_setStyleAttribute(this.contentElem, 'display', 'inline');
    DOM_setStyleAttribute(this.getElement(), 'whiteSpace', 'nowrap');
    DOM_setAttribute(this.itemTable, 'whiteSpace', 'nowrap');
    DOM_setStyleAttribute(this.childSpanElem, 'whiteSpace', 'nowrap');
    this.setStyleName(this.contentElem, 'gwt-TreeItem', true);
    if ((html != null)) {
    if (pyjslib_isString(html)) {
    this.setHTML(html);
    }
    else {
    this.setWidget(html);
    }
    }
    };
__ui_TreeItem.prototype.__init__.parse_kwargs = function ( __kwargs, html ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    var __r = [html];
    return __r;
};
    __ui_TreeItem.prototype.__class__.__init__ = function() {
        return __ui_TreeItem.prototype.__init__.call.apply(__ui_TreeItem.prototype.__init__, arguments);
    };
    __ui_TreeItem.prototype.__class__.__init__.unbound_method = true;
    __ui_TreeItem.prototype.__init__.instance_method = true;
    __ui_TreeItem.prototype.__class__.__init__.parse_kwargs = __ui_TreeItem.prototype.__init__.parse_kwargs;
    __ui_TreeItem.prototype.addItem = function(item) {
    if (!(pyjslib_hasattr(item, 'getTree'))) {
    var item = ui_TreeItem(item);
    }
    if (((item.getParentItem() != null)) || ((item.getTree() != null))) {
    item.remove();
    }
    item.setTree(this.tree);
    item.setParentItem(this);
    this.children.append(item);
    DOM_setStyleAttribute(item.getElement(), 'marginLeft',  ( 16 + 'px' ) );
    DOM_appendChild(this.childSpanElem, item.getElement());
    if ((pyjslib_len(this.children) == 1)) {
    this.updateState();
    }
    return item;
    };
    __ui_TreeItem.prototype.__class__.addItem = function() {
        return __ui_TreeItem.prototype.addItem.call.apply(__ui_TreeItem.prototype.addItem, arguments);
    };
    __ui_TreeItem.prototype.__class__.addItem.unbound_method = true;
    __ui_TreeItem.prototype.addItem.instance_method = true;
    __ui_TreeItem.prototype.getChild = function(index) {
    if (((index < 0)) || ((index >= pyjslib_len(this.children)))) {
    return;
    }
    return this.children.__getitem__(index);
    };
    __ui_TreeItem.prototype.__class__.getChild = function() {
        return __ui_TreeItem.prototype.getChild.call.apply(__ui_TreeItem.prototype.getChild, arguments);
    };
    __ui_TreeItem.prototype.__class__.getChild.unbound_method = true;
    __ui_TreeItem.prototype.getChild.instance_method = true;
    __ui_TreeItem.prototype.getChildCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_TreeItem.prototype.__class__.getChildCount = function() {
        return __ui_TreeItem.prototype.getChildCount.call.apply(__ui_TreeItem.prototype.getChildCount, arguments);
    };
    __ui_TreeItem.prototype.__class__.getChildCount.unbound_method = true;
    __ui_TreeItem.prototype.getChildCount.instance_method = true;
    __ui_TreeItem.prototype.getChildIndex = function(child) {
    return this.children.index(child);
    };
    __ui_TreeItem.prototype.__class__.getChildIndex = function() {
        return __ui_TreeItem.prototype.getChildIndex.call.apply(__ui_TreeItem.prototype.getChildIndex, arguments);
    };
    __ui_TreeItem.prototype.__class__.getChildIndex.unbound_method = true;
    __ui_TreeItem.prototype.getChildIndex.instance_method = true;
    __ui_TreeItem.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.contentElem);
    };
    __ui_TreeItem.prototype.__class__.getHTML = function() {
        return __ui_TreeItem.prototype.getHTML.call.apply(__ui_TreeItem.prototype.getHTML, arguments);
    };
    __ui_TreeItem.prototype.__class__.getHTML.unbound_method = true;
    __ui_TreeItem.prototype.getHTML.instance_method = true;
    __ui_TreeItem.prototype.getText = function() {
    return DOM_getInnerText(this.contentElem);
    };
    __ui_TreeItem.prototype.__class__.getText = function() {
        return __ui_TreeItem.prototype.getText.call.apply(__ui_TreeItem.prototype.getText, arguments);
    };
    __ui_TreeItem.prototype.__class__.getText.unbound_method = true;
    __ui_TreeItem.prototype.getText.instance_method = true;
    __ui_TreeItem.prototype.getParentItem = function() {
    return this.parent;
    };
    __ui_TreeItem.prototype.__class__.getParentItem = function() {
        return __ui_TreeItem.prototype.getParentItem.call.apply(__ui_TreeItem.prototype.getParentItem, arguments);
    };
    __ui_TreeItem.prototype.__class__.getParentItem.unbound_method = true;
    __ui_TreeItem.prototype.getParentItem.instance_method = true;
    __ui_TreeItem.prototype.getState = function() {
    return this.open;
    };
    __ui_TreeItem.prototype.__class__.getState = function() {
        return __ui_TreeItem.prototype.getState.call.apply(__ui_TreeItem.prototype.getState, arguments);
    };
    __ui_TreeItem.prototype.__class__.getState.unbound_method = true;
    __ui_TreeItem.prototype.getState.instance_method = true;
    __ui_TreeItem.prototype.getTree = function() {
    return this.tree;
    };
    __ui_TreeItem.prototype.__class__.getTree = function() {
        return __ui_TreeItem.prototype.getTree.call.apply(__ui_TreeItem.prototype.getTree, arguments);
    };
    __ui_TreeItem.prototype.__class__.getTree.unbound_method = true;
    __ui_TreeItem.prototype.getTree.instance_method = true;
    __ui_TreeItem.prototype.getUserObject = function() {
    return this.userObject;
    };
    __ui_TreeItem.prototype.__class__.getUserObject = function() {
        return __ui_TreeItem.prototype.getUserObject.call.apply(__ui_TreeItem.prototype.getUserObject, arguments);
    };
    __ui_TreeItem.prototype.__class__.getUserObject.unbound_method = true;
    __ui_TreeItem.prototype.getUserObject.instance_method = true;
    __ui_TreeItem.prototype.getWidget = function() {
    if ((this.contentPanel == null)) {
    return;
    }
    return this.contentPanel.getWidget();
    };
    __ui_TreeItem.prototype.__class__.getWidget = function() {
        return __ui_TreeItem.prototype.getWidget.call.apply(__ui_TreeItem.prototype.getWidget, arguments);
    };
    __ui_TreeItem.prototype.__class__.getWidget.unbound_method = true;
    __ui_TreeItem.prototype.getWidget.instance_method = true;
    __ui_TreeItem.prototype.isSelected = function() {
    return this.selected;
    };
    __ui_TreeItem.prototype.__class__.isSelected = function() {
        return __ui_TreeItem.prototype.isSelected.call.apply(__ui_TreeItem.prototype.isSelected, arguments);
    };
    __ui_TreeItem.prototype.__class__.isSelected.unbound_method = true;
    __ui_TreeItem.prototype.isSelected.instance_method = true;
    __ui_TreeItem.prototype.remove = function() {
    if ((this.parent != null)) {
    this.parent.removeItem(this);
    }
    else if ((this.tree != null)) {
    this.tree.removeItem(this);
    }
    };
    __ui_TreeItem.prototype.__class__.remove = function() {
        return __ui_TreeItem.prototype.remove.call.apply(__ui_TreeItem.prototype.remove, arguments);
    };
    __ui_TreeItem.prototype.__class__.remove.unbound_method = true;
    __ui_TreeItem.prototype.remove.instance_method = true;
    __ui_TreeItem.prototype.removeItem = function(item) {
    if (!this.children.__contains__(item)) {
    return;
    }
    item.setTree(null);
    item.setParentItem(null);
    this.children.remove(item);
    DOM_removeChild(this.childSpanElem, item.getElement());
    if ((pyjslib_len(this.children) == 0)) {
    this.updateState();
    }
    };
    __ui_TreeItem.prototype.__class__.removeItem = function() {
        return __ui_TreeItem.prototype.removeItem.call.apply(__ui_TreeItem.prototype.removeItem, arguments);
    };
    __ui_TreeItem.prototype.__class__.removeItem.unbound_method = true;
    __ui_TreeItem.prototype.removeItem.instance_method = true;
    __ui_TreeItem.prototype.removeItems = function() {
    while ((this.getChildCount() > 0)) {
    this.removeItem(this.getChild(0));
    }
    };
    __ui_TreeItem.prototype.__class__.removeItems = function() {
        return __ui_TreeItem.prototype.removeItems.call.apply(__ui_TreeItem.prototype.removeItems, arguments);
    };
    __ui_TreeItem.prototype.__class__.removeItems.unbound_method = true;
    __ui_TreeItem.prototype.removeItems.instance_method = true;
    __ui_TreeItem.prototype.setHTML = function(html) {
    this.clearContentPanel();
    DOM_setInnerHTML(this.contentElem, html);
    };
    __ui_TreeItem.prototype.__class__.setHTML = function() {
        return __ui_TreeItem.prototype.setHTML.call.apply(__ui_TreeItem.prototype.setHTML, arguments);
    };
    __ui_TreeItem.prototype.__class__.setHTML.unbound_method = true;
    __ui_TreeItem.prototype.setHTML.instance_method = true;
    __ui_TreeItem.prototype.setText = function(text) {
    this.clearContentPanel();
    DOM_setInnerText(this.contentElem, text);
    };
    __ui_TreeItem.prototype.__class__.setText = function() {
        return __ui_TreeItem.prototype.setText.call.apply(__ui_TreeItem.prototype.setText, arguments);
    };
    __ui_TreeItem.prototype.__class__.setText.unbound_method = true;
    __ui_TreeItem.prototype.setText.instance_method = true;
    __ui_TreeItem.prototype.setSelected = function(selected) {
    if ((this.selected == selected)) {
    return;
    }
    this.selected = selected;
    this.setStyleName(this.contentElem, 'gwt-TreeItem-selected', selected);
    };
    __ui_TreeItem.prototype.__class__.setSelected = function() {
        return __ui_TreeItem.prototype.setSelected.call.apply(__ui_TreeItem.prototype.setSelected, arguments);
    };
    __ui_TreeItem.prototype.__class__.setSelected.unbound_method = true;
    __ui_TreeItem.prototype.setSelected.instance_method = true;
    __ui_TreeItem.prototype.setState = function(open, fireEvents) {
    if (typeof fireEvents == 'undefined') fireEvents=true;
    if ((!(open)) || ((pyjslib_len(this.children) != 0))) {
    this.open = open;
    this.updateState();
    }
    if (fireEvents) {
    this.tree.fireStateChanged(this);
    }
    };
__ui_TreeItem.prototype.setState.parse_kwargs = function ( __kwargs, open, fireEvents ) {
    if (typeof fireEvents == 'undefined')
        fireEvents=__kwargs.fireEvents;
    var __r = [open, fireEvents];
    return __r;
};
    __ui_TreeItem.prototype.__class__.setState = function() {
        return __ui_TreeItem.prototype.setState.call.apply(__ui_TreeItem.prototype.setState, arguments);
    };
    __ui_TreeItem.prototype.__class__.setState.unbound_method = true;
    __ui_TreeItem.prototype.setState.instance_method = true;
    __ui_TreeItem.prototype.__class__.setState.parse_kwargs = __ui_TreeItem.prototype.setState.parse_kwargs;
    __ui_TreeItem.prototype.setUserObject = function(userObj) {
    this.userObject = userObj;
    };
    __ui_TreeItem.prototype.__class__.setUserObject = function() {
        return __ui_TreeItem.prototype.setUserObject.call.apply(__ui_TreeItem.prototype.setUserObject, arguments);
    };
    __ui_TreeItem.prototype.__class__.setUserObject.unbound_method = true;
    __ui_TreeItem.prototype.setUserObject.instance_method = true;
    __ui_TreeItem.prototype.setWidget = function(widget) {
    this.ensureContentPanel();
    this.contentPanel.setWidget(widget);
    };
    __ui_TreeItem.prototype.__class__.setWidget = function() {
        return __ui_TreeItem.prototype.setWidget.call.apply(__ui_TreeItem.prototype.setWidget, arguments);
    };
    __ui_TreeItem.prototype.__class__.setWidget.unbound_method = true;
    __ui_TreeItem.prototype.setWidget.instance_method = true;
    __ui_TreeItem.prototype.clearContentPanel = function() {
    if ((this.contentPanel != null)) {
    var child = this.contentPanel.getWidget();
    if ((child != null)) {
    this.contentPanel.remove(child);
    }
    if ((this.tree != null)) {
    this.tree.disown(this.contentPanel);
    this.contentPanel = null;
    }
    }
    };
    __ui_TreeItem.prototype.__class__.clearContentPanel = function() {
        return __ui_TreeItem.prototype.clearContentPanel.call.apply(__ui_TreeItem.prototype.clearContentPanel, arguments);
    };
    __ui_TreeItem.prototype.__class__.clearContentPanel.unbound_method = true;
    __ui_TreeItem.prototype.clearContentPanel.instance_method = true;
    __ui_TreeItem.prototype.ensureContentPanel = function() {
    if ((this.contentPanel == null)) {
    DOM_setInnerHTML(this.contentElem, '');
    this.contentPanel = ui_TreeContentPanel(this.contentElem);
    this.contentPanel.setTreeItem(this);
    if ((this.getTree() != null)) {
    this.tree.adopt(this.contentPanel);
    }
    }
    };
    __ui_TreeItem.prototype.__class__.ensureContentPanel = function() {
        return __ui_TreeItem.prototype.ensureContentPanel.call.apply(__ui_TreeItem.prototype.ensureContentPanel, arguments);
    };
    __ui_TreeItem.prototype.__class__.ensureContentPanel.unbound_method = true;
    __ui_TreeItem.prototype.ensureContentPanel.instance_method = true;
    __ui_TreeItem.prototype.addTreeItems = function(accum) {

        var __item = this.children.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    accum.append(item);
    item.addTreeItems(accum);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_TreeItem.prototype.__class__.addTreeItems = function() {
        return __ui_TreeItem.prototype.addTreeItems.call.apply(__ui_TreeItem.prototype.addTreeItems, arguments);
    };
    __ui_TreeItem.prototype.__class__.addTreeItems.unbound_method = true;
    __ui_TreeItem.prototype.addTreeItems.instance_method = true;
    __ui_TreeItem.prototype.getChildren = function() {
    return this.children;
    };
    __ui_TreeItem.prototype.__class__.getChildren = function() {
        return __ui_TreeItem.prototype.getChildren.call.apply(__ui_TreeItem.prototype.getChildren, arguments);
    };
    __ui_TreeItem.prototype.__class__.getChildren.unbound_method = true;
    __ui_TreeItem.prototype.getChildren.instance_method = true;
    __ui_TreeItem.prototype.getContentElem = function() {
    return this.contentElem;
    };
    __ui_TreeItem.prototype.__class__.getContentElem = function() {
        return __ui_TreeItem.prototype.getContentElem.call.apply(__ui_TreeItem.prototype.getContentElem, arguments);
    };
    __ui_TreeItem.prototype.__class__.getContentElem.unbound_method = true;
    __ui_TreeItem.prototype.getContentElem.instance_method = true;
    __ui_TreeItem.prototype.getContentHeight = function() {
    return DOM_getIntAttribute(this.itemTable, 'offsetHeight');
    };
    __ui_TreeItem.prototype.__class__.getContentHeight = function() {
        return __ui_TreeItem.prototype.getContentHeight.call.apply(__ui_TreeItem.prototype.getContentHeight, arguments);
    };
    __ui_TreeItem.prototype.__class__.getContentHeight.unbound_method = true;
    __ui_TreeItem.prototype.getContentHeight.instance_method = true;
    __ui_TreeItem.prototype.getImageElement = function() {
    return this.imgElem;
    };
    __ui_TreeItem.prototype.__class__.getImageElement = function() {
        return __ui_TreeItem.prototype.getImageElement.call.apply(__ui_TreeItem.prototype.getImageElement, arguments);
    };
    __ui_TreeItem.prototype.__class__.getImageElement.unbound_method = true;
    __ui_TreeItem.prototype.getImageElement.instance_method = true;
    __ui_TreeItem.prototype.getTreeTop = function() {
    var item = this;
    var ret = 0;
    while ((item != null)) {
    ret += DOM_getIntAttribute(item.getElement(), 'offsetTop');
    var item = item.getParentItem();
    }
    return ret;
    };
    __ui_TreeItem.prototype.__class__.getTreeTop = function() {
        return __ui_TreeItem.prototype.getTreeTop.call.apply(__ui_TreeItem.prototype.getTreeTop, arguments);
    };
    __ui_TreeItem.prototype.__class__.getTreeTop.unbound_method = true;
    __ui_TreeItem.prototype.getTreeTop.instance_method = true;
    __ui_TreeItem.prototype.getFocusableWidget = function() {
    var widget = this.getWidget();
    if (pyjslib_hasattr(widget, 'setFocus')) {
    return widget;
    }
    return;
    };
    __ui_TreeItem.prototype.__class__.getFocusableWidget = function() {
        return __ui_TreeItem.prototype.getFocusableWidget.call.apply(__ui_TreeItem.prototype.getFocusableWidget, arguments);
    };
    __ui_TreeItem.prototype.__class__.getFocusableWidget.unbound_method = true;
    __ui_TreeItem.prototype.getFocusableWidget.instance_method = true;
    __ui_TreeItem.prototype.imgSrc = function(img) {
    if ((this.tree == null)) {
    return img;
    }
    var src =  ( this.tree.getImageBase() + img ) ;
    return src;
    };
    __ui_TreeItem.prototype.__class__.imgSrc = function() {
        return __ui_TreeItem.prototype.imgSrc.call.apply(__ui_TreeItem.prototype.imgSrc, arguments);
    };
    __ui_TreeItem.prototype.__class__.imgSrc.unbound_method = true;
    __ui_TreeItem.prototype.imgSrc.instance_method = true;
    __ui_TreeItem.prototype.setParentItem = function(parent) {
    this.parent = parent;
    };
    __ui_TreeItem.prototype.__class__.setParentItem = function() {
        return __ui_TreeItem.prototype.setParentItem.call.apply(__ui_TreeItem.prototype.setParentItem, arguments);
    };
    __ui_TreeItem.prototype.__class__.setParentItem.unbound_method = true;
    __ui_TreeItem.prototype.setParentItem.instance_method = true;
    __ui_TreeItem.prototype.setTree = function(tree) {
    if ((this.tree == tree)) {
    return;
    }
    if ((this.tree != null)) {
    if ((this.tree.getSelectedItem() == this)) {
    this.tree.setSelectedItem(null);
    }
    if ((this.contentPanel != null)) {
    this.tree.disown(this.contentPanel);
    }
    }
    this.tree = tree;

        var __child = this.children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.setTree(tree);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    this.updateState();
    if (((tree != null)) && ((this.contentPanel != null))) {
    tree.adopt(this.contentPanel);
    }
    };
    __ui_TreeItem.prototype.__class__.setTree = function() {
        return __ui_TreeItem.prototype.setTree.call.apply(__ui_TreeItem.prototype.setTree, arguments);
    };
    __ui_TreeItem.prototype.__class__.setTree.unbound_method = true;
    __ui_TreeItem.prototype.setTree.instance_method = true;
    __ui_TreeItem.prototype.updateState = function() {
    if ((pyjslib_len(this.children) == 0)) {
    this.setVisible(this.childSpanElem, false);
    DOM_setAttribute(this.imgElem, 'src', this.imgSrc('tree_white.gif'));
    return;
    }
    if (this.open) {
    this.setVisible(this.childSpanElem, true);
    DOM_setAttribute(this.imgElem, 'src', this.imgSrc('tree_open.gif'));
    }
    else {
    this.setVisible(this.childSpanElem, false);
    DOM_setAttribute(this.imgElem, 'src', this.imgSrc('tree_closed.gif'));
    }
    };
    __ui_TreeItem.prototype.__class__.updateState = function() {
        return __ui_TreeItem.prototype.updateState.call.apply(__ui_TreeItem.prototype.updateState, arguments);
    };
    __ui_TreeItem.prototype.__class__.updateState.unbound_method = true;
    __ui_TreeItem.prototype.updateState.instance_method = true;
    __ui_TreeItem.prototype.updateStateRecursive = function() {
    this.updateState();

        var __i = pyjslib_range(pyjslib_len(this.children)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var child = this.children.__getitem__(i);
    child.updateStateRecursive();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_TreeItem.prototype.__class__.updateStateRecursive = function() {
        return __ui_TreeItem.prototype.updateStateRecursive.call.apply(__ui_TreeItem.prototype.updateStateRecursive, arguments);
    };
    __ui_TreeItem.prototype.__class__.updateStateRecursive.unbound_method = true;
    __ui_TreeItem.prototype.updateStateRecursive.instance_method = true;
}
function __ui_RootTreeItem() {
}
function ui_RootTreeItem() {
    var instance = new __ui_RootTreeItem();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_RootTreeItem_initialize() {
    if(__ui_RootTreeItem.__was_initialized__) return;
    __ui_RootTreeItem.__was_initialized__ = true;
    if(!__ui_TreeItem.__was_initialized__)
        __ui_TreeItem_initialize();
    pyjs_extend(__ui_RootTreeItem, __ui_TreeItem);
    __ui_RootTreeItem.prototype.__class__.__new__ = ui_RootTreeItem;
    __ui_RootTreeItem.prototype.addItem = function(item) {
    if (((item.getParentItem() != null)) || ((item.getTree() != null))) {
    item.remove();
    }
    item.setTree(this.getTree());
    item.setParentItem(null);
    this.children.append(item);
    DOM_setIntStyleAttribute(item.getElement(), 'marginLeft', 0);
    };
    __ui_RootTreeItem.prototype.__class__.addItem = function() {
        return __ui_RootTreeItem.prototype.addItem.call.apply(__ui_RootTreeItem.prototype.addItem, arguments);
    };
    __ui_RootTreeItem.prototype.__class__.addItem.unbound_method = true;
    __ui_RootTreeItem.prototype.addItem.instance_method = true;
    __ui_RootTreeItem.prototype.removeItem = function(item) {
    if (!this.children.__contains__(item)) {
    return;
    }
    item.setTree(null);
    item.setParentItem(null);
    this.children.remove(item);
    };
    __ui_RootTreeItem.prototype.__class__.removeItem = function() {
        return __ui_RootTreeItem.prototype.removeItem.call.apply(__ui_RootTreeItem.prototype.removeItem, arguments);
    };
    __ui_RootTreeItem.prototype.__class__.removeItem.unbound_method = true;
    __ui_RootTreeItem.prototype.removeItem.instance_method = true;
}
function __ui_Tree() {
}
function ui_Tree() {
    var instance = new __ui_Tree();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Tree_initialize() {
    if(__ui_Tree.__was_initialized__) return;
    __ui_Tree.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Tree, __ui_Widget);
    __ui_Tree.prototype.__class__.__new__ = ui_Tree;
    __ui_Tree.prototype.__init__ = function() {
    __ui_Widget.prototype.__class__.__init__(this);
    this.root = null;
    this.childWidgets = sets_Set();
    this.curSelection = null;
    this.focusable = null;
    this.focusListeners = new pyjslib_List([]);
    this.mouseListeners = new pyjslib_List([]);
    this.imageBase = pygwt_getModuleBaseURL();
    this.keyboardListeners = new pyjslib_List([]);
    this.listeners = new pyjslib_List([]);
    this.lastEventType = '';
    this.setElement(DOM_createDiv());
    DOM_setStyleAttribute(this.getElement(), 'position', 'relative');
    this.focusable = __ui_Focus.prototype.__class__.createFocusable();
    DOM_setStyleAttribute(this.focusable, 'fontSize', '0');
    DOM_setStyleAttribute(this.focusable, 'position', 'absolute');
    DOM_setIntStyleAttribute(this.focusable, 'zIndex', -1);
    DOM_appendChild(this.getElement(), this.focusable);
    this.sinkEvents((__ui_Event.prototype.__class__.MOUSEEVENTS | __ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.KEYEVENTS));
    DOM_sinkEvents(this.focusable, __ui_Event.prototype.__class__.FOCUSEVENTS);
    this.root = ui_RootTreeItem();
    this.root.setTree(this);
    this.setStyleName('gwt-Tree');
    };
    __ui_Tree.prototype.__class__.__init__ = function() {
        return __ui_Tree.prototype.__init__.call.apply(__ui_Tree.prototype.__init__, arguments);
    };
    __ui_Tree.prototype.__class__.__init__.unbound_method = true;
    __ui_Tree.prototype.__init__.instance_method = true;
    __ui_Tree.prototype.add = function(widget) {
    this.addItem(widget);
    };
    __ui_Tree.prototype.__class__.add = function() {
        return __ui_Tree.prototype.add.call.apply(__ui_Tree.prototype.add, arguments);
    };
    __ui_Tree.prototype.__class__.add.unbound_method = true;
    __ui_Tree.prototype.add.instance_method = true;
    __ui_Tree.prototype.addFocusListener = function(listener) {
    this.focusListeners.append(listener);
    };
    __ui_Tree.prototype.__class__.addFocusListener = function() {
        return __ui_Tree.prototype.addFocusListener.call.apply(__ui_Tree.prototype.addFocusListener, arguments);
    };
    __ui_Tree.prototype.__class__.addFocusListener.unbound_method = true;
    __ui_Tree.prototype.addFocusListener.instance_method = true;
    __ui_Tree.prototype.addItem = function(item) {
    if (pyjslib_isString(item)) {
    var item = ui_TreeItem(item);
    }
    var ret = this.root.addItem(item);
    DOM_appendChild(this.getElement(), item.getElement());
    return ret;
    };
    __ui_Tree.prototype.__class__.addItem = function() {
        return __ui_Tree.prototype.addItem.call.apply(__ui_Tree.prototype.addItem, arguments);
    };
    __ui_Tree.prototype.__class__.addItem.unbound_method = true;
    __ui_Tree.prototype.addItem.instance_method = true;
    __ui_Tree.prototype.addKeyboardListener = function(listener) {
    this.keyboardListeners.append(listener);
    };
    __ui_Tree.prototype.__class__.addKeyboardListener = function() {
        return __ui_Tree.prototype.addKeyboardListener.call.apply(__ui_Tree.prototype.addKeyboardListener, arguments);
    };
    __ui_Tree.prototype.__class__.addKeyboardListener.unbound_method = true;
    __ui_Tree.prototype.addKeyboardListener.instance_method = true;
    __ui_Tree.prototype.addMouseListener = function(listener) {
    this.mouseListeners.append(listener);
    };
    __ui_Tree.prototype.__class__.addMouseListener = function() {
        return __ui_Tree.prototype.addMouseListener.call.apply(__ui_Tree.prototype.addMouseListener, arguments);
    };
    __ui_Tree.prototype.__class__.addMouseListener.unbound_method = true;
    __ui_Tree.prototype.addMouseListener.instance_method = true;
    __ui_Tree.prototype.addTreeListener = function(listener) {
    this.listeners.append(listener);
    };
    __ui_Tree.prototype.__class__.addTreeListener = function() {
        return __ui_Tree.prototype.addTreeListener.call.apply(__ui_Tree.prototype.addTreeListener, arguments);
    };
    __ui_Tree.prototype.__class__.addTreeListener.unbound_method = true;
    __ui_Tree.prototype.addTreeListener.instance_method = true;
    __ui_Tree.prototype.clear = function() {
    var size = this.root.getChildCount();

        var __i = pyjslib_range(size, 0, -1).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.root.getChild( ( i - 1 ) ).remove();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Tree.prototype.__class__.clear = function() {
        return __ui_Tree.prototype.clear.call.apply(__ui_Tree.prototype.clear, arguments);
    };
    __ui_Tree.prototype.__class__.clear.unbound_method = true;
    __ui_Tree.prototype.clear.instance_method = true;
    __ui_Tree.prototype.ensureSelectedItemVisible = function() {
    if ((this.curSelection == null)) {
    return;
    }
    var parent = this.curSelection.getParentItem();
    while ((parent != null)) {
    parent.setState(true);
    var parent = parent.getParentItem();
    }
    };
    __ui_Tree.prototype.__class__.ensureSelectedItemVisible = function() {
        return __ui_Tree.prototype.ensureSelectedItemVisible.call.apply(__ui_Tree.prototype.ensureSelectedItemVisible, arguments);
    };
    __ui_Tree.prototype.__class__.ensureSelectedItemVisible.unbound_method = true;
    __ui_Tree.prototype.ensureSelectedItemVisible.instance_method = true;
    __ui_Tree.prototype.getImageBase = function() {
    return this.imageBase;
    };
    __ui_Tree.prototype.__class__.getImageBase = function() {
        return __ui_Tree.prototype.getImageBase.call.apply(__ui_Tree.prototype.getImageBase, arguments);
    };
    __ui_Tree.prototype.__class__.getImageBase.unbound_method = true;
    __ui_Tree.prototype.getImageBase.instance_method = true;
    __ui_Tree.prototype.getItem = function(index) {
    return this.root.getChild(index);
    };
    __ui_Tree.prototype.__class__.getItem = function() {
        return __ui_Tree.prototype.getItem.call.apply(__ui_Tree.prototype.getItem, arguments);
    };
    __ui_Tree.prototype.__class__.getItem.unbound_method = true;
    __ui_Tree.prototype.getItem.instance_method = true;
    __ui_Tree.prototype.getItemCount = function() {
    return this.root.getChildCount();
    };
    __ui_Tree.prototype.__class__.getItemCount = function() {
        return __ui_Tree.prototype.getItemCount.call.apply(__ui_Tree.prototype.getItemCount, arguments);
    };
    __ui_Tree.prototype.__class__.getItemCount.unbound_method = true;
    __ui_Tree.prototype.getItemCount.instance_method = true;
    __ui_Tree.prototype.getSelectedItem = function() {
    return this.curSelection;
    };
    __ui_Tree.prototype.__class__.getSelectedItem = function() {
        return __ui_Tree.prototype.getSelectedItem.call.apply(__ui_Tree.prototype.getSelectedItem, arguments);
    };
    __ui_Tree.prototype.__class__.getSelectedItem.unbound_method = true;
    __ui_Tree.prototype.getSelectedItem.instance_method = true;
    __ui_Tree.prototype.getTabIndex = function() {
    return __ui_Focus.prototype.__class__.getTabIndex(this, this.focusable);
    };
    __ui_Tree.prototype.__class__.getTabIndex = function() {
        return __ui_Tree.prototype.getTabIndex.call.apply(__ui_Tree.prototype.getTabIndex, arguments);
    };
    __ui_Tree.prototype.__class__.getTabIndex.unbound_method = true;
    __ui_Tree.prototype.getTabIndex.instance_method = true;
    __ui_Tree.prototype.__iter__ = function() {
    return this.childWidgets.__iter__();
    };
    __ui_Tree.prototype.__class__.__iter__ = function() {
        return __ui_Tree.prototype.__iter__.call.apply(__ui_Tree.prototype.__iter__, arguments);
    };
    __ui_Tree.prototype.__class__.__iter__.unbound_method = true;
    __ui_Tree.prototype.__iter__.instance_method = true;
    __ui_Tree.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    var e = DOM_eventGetTarget(event);
    if (!(this.shouldTreeDelegateFocusToElement(e))) {
    this.setFocus(true);
    }
    }
    else if ((type == 'mousedown')) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    this.elementClicked(this.root, DOM_eventGetTarget(event));
    }
    else if (((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'mouseover')) || ((type == 'mouseout'))) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    }
    else if (((type == 'blur')) || ((type == 'focus'))) {
    __ui_FocusListener.prototype.__class__.fireFocusEvent(this, this.focusListeners, this, event);
    }
    else if ((type == 'keydown')) {
    if ((this.curSelection == null)) {
    if ((this.root.getChildCount() > 0)) {
    this.onSelection(this.root.getChild(0), true);
    }
    __ui_Widget.prototype.__class__.onBrowserEvent(this, event);
    return;
    }
    if ((this.lastEventType == 'keydown')) {
    return;
    }
    var keycode = DOM_eventGetKeyCode(event);
    if ((keycode == __ui_KeyboardListener.prototype.__class__.KEY_UP)) {
    this.moveSelectionUp(this.curSelection, true);
    DOM_eventPreventDefault(event);
    }
    else if ((keycode == __ui_KeyboardListener.prototype.__class__.KEY_DOWN)) {
    this.moveSelectionDown(this.curSelection, true);
    DOM_eventPreventDefault(event);
    }
    else if ((keycode == __ui_KeyboardListener.prototype.__class__.KEY_LEFT)) {
    if (this.curSelection.getState()) {
    this.curSelection.setState(false);
    }
    DOM_eventPreventDefault(event);
    }
    else if ((keycode == __ui_KeyboardListener.prototype.__class__.KEY_RIGHT)) {
    if (!(this.curSelection.getState())) {
    this.curSelection.setState(true);
    }
    DOM_eventPreventDefault(event);
    }
    }
    else if ((type == 'keyup')) {
    if ((DOM_eventGetKeyCode(event) == __ui_KeyboardListener.prototype.__class__.KEY_TAB)) {
    var chain = new pyjslib_List([]);
    this.collectElementChain(chain, this.getElement(), DOM_eventGetTarget(event));
    var item = this.findItemByChain(chain, 0, this.root);
    if ((item != this.getSelectedItem())) {
    this.setSelectedItem(item, true);
    }
    }
    }
    else if ((type == 'keypress')) {
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent(this, this.keyboardListeners, this, event);
    }
    __ui_Widget.prototype.__class__.onBrowserEvent(this, event);
    this.lastEventType = type;
    };
    __ui_Tree.prototype.__class__.onBrowserEvent = function() {
        return __ui_Tree.prototype.onBrowserEvent.call.apply(__ui_Tree.prototype.onBrowserEvent, arguments);
    };
    __ui_Tree.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Tree.prototype.onBrowserEvent.instance_method = true;
    __ui_Tree.prototype.remove = function(widget) {
    console.error('Widgets should never be directly removed from a tree');
    };
    __ui_Tree.prototype.__class__.remove = function() {
        return __ui_Tree.prototype.remove.call.apply(__ui_Tree.prototype.remove, arguments);
    };
    __ui_Tree.prototype.__class__.remove.unbound_method = true;
    __ui_Tree.prototype.remove.instance_method = true;
    __ui_Tree.prototype.removeFocusListener = function(listener) {
    this.focusListeners.remove(listener);
    };
    __ui_Tree.prototype.__class__.removeFocusListener = function() {
        return __ui_Tree.prototype.removeFocusListener.call.apply(__ui_Tree.prototype.removeFocusListener, arguments);
    };
    __ui_Tree.prototype.__class__.removeFocusListener.unbound_method = true;
    __ui_Tree.prototype.removeFocusListener.instance_method = true;
    __ui_Tree.prototype.removeItem = function(item) {
    this.root.removeItem(item);
    DOM_removeChild(this.getElement(), item.getElement());
    };
    __ui_Tree.prototype.__class__.removeItem = function() {
        return __ui_Tree.prototype.removeItem.call.apply(__ui_Tree.prototype.removeItem, arguments);
    };
    __ui_Tree.prototype.__class__.removeItem.unbound_method = true;
    __ui_Tree.prototype.removeItem.instance_method = true;
    __ui_Tree.prototype.removeItems = function() {
    while ((this.getItemCount() > 0)) {
    this.removeItem(this.getItem(0));
    }
    };
    __ui_Tree.prototype.__class__.removeItems = function() {
        return __ui_Tree.prototype.removeItems.call.apply(__ui_Tree.prototype.removeItems, arguments);
    };
    __ui_Tree.prototype.__class__.removeItems.unbound_method = true;
    __ui_Tree.prototype.removeItems.instance_method = true;
    __ui_Tree.prototype.removeKeyboardListener = function(listener) {
    this.keyboardListeners.remove(listener);
    };
    __ui_Tree.prototype.__class__.removeKeyboardListener = function() {
        return __ui_Tree.prototype.removeKeyboardListener.call.apply(__ui_Tree.prototype.removeKeyboardListener, arguments);
    };
    __ui_Tree.prototype.__class__.removeKeyboardListener.unbound_method = true;
    __ui_Tree.prototype.removeKeyboardListener.instance_method = true;
    __ui_Tree.prototype.removeTreeListener = function(listener) {
    this.listeners.remove(listener);
    };
    __ui_Tree.prototype.__class__.removeTreeListener = function() {
        return __ui_Tree.prototype.removeTreeListener.call.apply(__ui_Tree.prototype.removeTreeListener, arguments);
    };
    __ui_Tree.prototype.__class__.removeTreeListener.unbound_method = true;
    __ui_Tree.prototype.removeTreeListener.instance_method = true;
    __ui_Tree.prototype.setAccessKey = function(key) {
    __ui_Focus.prototype.__class__.setAccessKey(this, this.focusable, key);
    };
    __ui_Tree.prototype.__class__.setAccessKey = function() {
        return __ui_Tree.prototype.setAccessKey.call.apply(__ui_Tree.prototype.setAccessKey, arguments);
    };
    __ui_Tree.prototype.__class__.setAccessKey.unbound_method = true;
    __ui_Tree.prototype.setAccessKey.instance_method = true;
    __ui_Tree.prototype.setFocus = function(focus) {
    if (focus) {
    __ui_Focus.prototype.__class__.focus(this, this.focusable);
    }
    else {
    __ui_Focus.prototype.__class__.blur(this, this.focusable);
    }
    };
    __ui_Tree.prototype.__class__.setFocus = function() {
        return __ui_Tree.prototype.setFocus.call.apply(__ui_Tree.prototype.setFocus, arguments);
    };
    __ui_Tree.prototype.__class__.setFocus.unbound_method = true;
    __ui_Tree.prototype.setFocus.instance_method = true;
    __ui_Tree.prototype.setImageBase = function(baseUrl) {
    this.imageBase = baseUrl;
    this.root.updateStateRecursive();
    };
    __ui_Tree.prototype.__class__.setImageBase = function() {
        return __ui_Tree.prototype.setImageBase.call.apply(__ui_Tree.prototype.setImageBase, arguments);
    };
    __ui_Tree.prototype.__class__.setImageBase.unbound_method = true;
    __ui_Tree.prototype.setImageBase.instance_method = true;
    __ui_Tree.prototype.setSelectedItem = function(item, fireEvents) {
    if (typeof fireEvents == 'undefined') fireEvents=true;
    if ((item == null)) {
    if ((this.curSelection == null)) {
    return;
    }
    this.curSelection.setSelected(false);
    this.curSelection = null;
    return;
    }
    this.onSelection(item, fireEvents);
    };
__ui_Tree.prototype.setSelectedItem.parse_kwargs = function ( __kwargs, item, fireEvents ) {
    if (typeof fireEvents == 'undefined')
        fireEvents=__kwargs.fireEvents;
    var __r = [item, fireEvents];
    return __r;
};
    __ui_Tree.prototype.__class__.setSelectedItem = function() {
        return __ui_Tree.prototype.setSelectedItem.call.apply(__ui_Tree.prototype.setSelectedItem, arguments);
    };
    __ui_Tree.prototype.__class__.setSelectedItem.unbound_method = true;
    __ui_Tree.prototype.setSelectedItem.instance_method = true;
    __ui_Tree.prototype.__class__.setSelectedItem.parse_kwargs = __ui_Tree.prototype.setSelectedItem.parse_kwargs;
    __ui_Tree.prototype.setTabIndex = function(index) {
    __ui_Focus.prototype.__class__.setTabIndex(this, this.focusable, index);
    };
    __ui_Tree.prototype.__class__.setTabIndex = function() {
        return __ui_Tree.prototype.setTabIndex.call.apply(__ui_Tree.prototype.setTabIndex, arguments);
    };
    __ui_Tree.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_Tree.prototype.setTabIndex.instance_method = true;
    __ui_Tree.prototype.treeItemIterator = function() {
    var accum = new pyjslib_List([]);
    this.root.addTreeItems(accum);
    return accum.__iter__();
    };
    __ui_Tree.prototype.__class__.treeItemIterator = function() {
        return __ui_Tree.prototype.treeItemIterator.call.apply(__ui_Tree.prototype.treeItemIterator, arguments);
    };
    __ui_Tree.prototype.__class__.treeItemIterator.unbound_method = true;
    __ui_Tree.prototype.treeItemIterator.instance_method = true;
    __ui_Tree.prototype.collectElementChain = function(chain, hRoot, hElem) {
    if (((hElem == null)) || (DOM_compare(hElem, hRoot))) {
    return;
    }
    this.collectElementChain(chain, hRoot, DOM_getParent(hElem));
    chain.append(hElem);
    };
    __ui_Tree.prototype.__class__.collectElementChain = function() {
        return __ui_Tree.prototype.collectElementChain.call.apply(__ui_Tree.prototype.collectElementChain, arguments);
    };
    __ui_Tree.prototype.__class__.collectElementChain.unbound_method = true;
    __ui_Tree.prototype.collectElementChain.instance_method = true;
    __ui_Tree.prototype.elementClicked = function(root, hElem) {
    var chain = new pyjslib_List([]);
    this.collectElementChain(chain, this.getElement(), hElem);
    var item = this.findItemByChain(chain, 0, root);
    if ((item != null)) {
    if (DOM_compare(item.getImageElement(), hElem)) {
    item.setState(!(item.getState()), true);
    return true;
    }
    else if (DOM_isOrHasChild(item.getElement(), hElem)) {
    this.onSelection(item, true);
    return true;
    }
    }
    return false;
    };
    __ui_Tree.prototype.__class__.elementClicked = function() {
        return __ui_Tree.prototype.elementClicked.call.apply(__ui_Tree.prototype.elementClicked, arguments);
    };
    __ui_Tree.prototype.__class__.elementClicked.unbound_method = true;
    __ui_Tree.prototype.elementClicked.instance_method = true;
    __ui_Tree.prototype.findDeepestOpenChild = function(item) {
    if (!(item.getState())) {
    return item;
    }
    return this.findDeepestOpenChild(item.getChild( ( item.getChildCount() - 1 ) ));
    };
    __ui_Tree.prototype.__class__.findDeepestOpenChild = function() {
        return __ui_Tree.prototype.findDeepestOpenChild.call.apply(__ui_Tree.prototype.findDeepestOpenChild, arguments);
    };
    __ui_Tree.prototype.__class__.findDeepestOpenChild.unbound_method = true;
    __ui_Tree.prototype.findDeepestOpenChild.instance_method = true;
    __ui_Tree.prototype.findItemByChain = function(chain, idx, root) {
    if ((idx == pyjslib_len(chain))) {
    return root;
    }
    var hCurElem = chain.__getitem__(idx);

        var __i = pyjslib_range(root.getChildCount()).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var child = root.getChild(i);
    if (DOM_compare(child.getElement(), hCurElem)) {
    var retItem = this.findItemByChain(chain,  ( idx + 1 ) , root.getChild(i));
    if ((retItem == null)) {
    return child;
    }
    return retItem;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return this.findItemByChain(chain,  ( idx + 1 ) , root);
    };
    __ui_Tree.prototype.__class__.findItemByChain = function() {
        return __ui_Tree.prototype.findItemByChain.call.apply(__ui_Tree.prototype.findItemByChain, arguments);
    };
    __ui_Tree.prototype.__class__.findItemByChain.unbound_method = true;
    __ui_Tree.prototype.findItemByChain.instance_method = true;
    __ui_Tree.prototype.moveFocus = function(selection) {
    var focusableWidget = selection.getFocusableWidget();
    if ((focusableWidget != null)) {
    focusableWidget.setFocus(true);
    DOM_scrollIntoView(focusableWidget.getElement());
    }
    else {
    var selectedElem = selection.getContentElem();
    var containerLeft = this.getAbsoluteLeft();
    var containerTop = this.getAbsoluteTop();
    var left =  ( DOM_getAbsoluteLeft(selectedElem) - containerLeft ) ;
    var top =  ( DOM_getAbsoluteTop(selectedElem) - containerTop ) ;
    var width = DOM_getIntAttribute(selectedElem, 'offsetWidth');
    var height = DOM_getIntAttribute(selectedElem, 'offsetHeight');
    DOM_setIntStyleAttribute(this.focusable, 'left', left);
    DOM_setIntStyleAttribute(this.focusable, 'top', top);
    DOM_setIntStyleAttribute(this.focusable, 'width', width);
    DOM_setIntStyleAttribute(this.focusable, 'height', height);
    DOM_scrollIntoView(this.focusable);
    __ui_Focus.prototype.__class__.focus(this, this.focusable);
    }
    };
    __ui_Tree.prototype.__class__.moveFocus = function() {
        return __ui_Tree.prototype.moveFocus.call.apply(__ui_Tree.prototype.moveFocus, arguments);
    };
    __ui_Tree.prototype.__class__.moveFocus.unbound_method = true;
    __ui_Tree.prototype.moveFocus.instance_method = true;
    __ui_Tree.prototype.moveSelectionDown = function(sel, dig) {
    if ((sel == this.root)) {
    return;
    }
    var parent = sel.getParentItem();
    if ((parent == null)) {
    var parent = this.root;
    }
    var idx = parent.getChildIndex(sel);
    if ((!(dig)) || (!(sel.getState()))) {
    if ((idx <  ( parent.getChildCount() - 1 ) )) {
    this.onSelection(parent.getChild( ( idx + 1 ) ), true);
    }
    else {
    this.moveSelectionDown(parent, false);
    }
    }
    else if ((sel.getChildCount() > 0)) {
    this.onSelection(sel.getChild(0), true);
    }
    };
    __ui_Tree.prototype.__class__.moveSelectionDown = function() {
        return __ui_Tree.prototype.moveSelectionDown.call.apply(__ui_Tree.prototype.moveSelectionDown, arguments);
    };
    __ui_Tree.prototype.__class__.moveSelectionDown.unbound_method = true;
    __ui_Tree.prototype.moveSelectionDown.instance_method = true;
    __ui_Tree.prototype.moveSelectionUp = function(sel, climb) {
    var parent = sel.getParentItem();
    if ((parent == null)) {
    var parent = this.root;
    }
    var idx = parent.getChildIndex(sel);
    if ((idx > 0)) {
    var sibling = parent.getChild( ( idx - 1 ) );
    this.onSelection(this.findDeepestOpenChild(sibling), true);
    }
    else {
    this.onSelection(parent, true);
    }
    };
    __ui_Tree.prototype.__class__.moveSelectionUp = function() {
        return __ui_Tree.prototype.moveSelectionUp.call.apply(__ui_Tree.prototype.moveSelectionUp, arguments);
    };
    __ui_Tree.prototype.__class__.moveSelectionUp.unbound_method = true;
    __ui_Tree.prototype.moveSelectionUp.instance_method = true;
    __ui_Tree.prototype.onSelection = function(item, fireEvents) {
    if ((item == this.root)) {
    return;
    }
    if ((this.curSelection != null)) {
    this.curSelection.setSelected(false);
    }
    this.curSelection = item;
    if ((this.curSelection != null)) {
    this.moveFocus(this.curSelection);
    this.curSelection.setSelected(true);
    if ((fireEvents) && (pyjslib_len(this.listeners))) {

        var __listener = this.listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onTreeItemSelected(item);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    }
    };
    __ui_Tree.prototype.__class__.onSelection = function() {
        return __ui_Tree.prototype.onSelection.call.apply(__ui_Tree.prototype.onSelection, arguments);
    };
    __ui_Tree.prototype.__class__.onSelection.unbound_method = true;
    __ui_Tree.prototype.onSelection.instance_method = true;
    __ui_Tree.prototype.doAttachChildren = function() {

        var __child = this.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.onAttach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    DOM_setEventListener(this.focusable, this);
    };
    __ui_Tree.prototype.__class__.doAttachChildren = function() {
        return __ui_Tree.prototype.doAttachChildren.call.apply(__ui_Tree.prototype.doAttachChildren, arguments);
    };
    __ui_Tree.prototype.__class__.doAttachChildren.unbound_method = true;
    __ui_Tree.prototype.doAttachChildren.instance_method = true;
    __ui_Tree.prototype.doDetachChildren = function() {

        var __child = this.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.onDetach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    DOM_setEventListener(this.focusable, null);
    };
    __ui_Tree.prototype.__class__.doDetachChildren = function() {
        return __ui_Tree.prototype.doDetachChildren.call.apply(__ui_Tree.prototype.doDetachChildren, arguments);
    };
    __ui_Tree.prototype.__class__.doDetachChildren.unbound_method = true;
    __ui_Tree.prototype.doDetachChildren.instance_method = true;
    __ui_Tree.prototype.onLoad = function() {
    this.root.updateStateRecursive();
    };
    __ui_Tree.prototype.__class__.onLoad = function() {
        return __ui_Tree.prototype.onLoad.call.apply(__ui_Tree.prototype.onLoad, arguments);
    };
    __ui_Tree.prototype.__class__.onLoad.unbound_method = true;
    __ui_Tree.prototype.onLoad.instance_method = true;
    __ui_Tree.prototype.adopt = function(content) {
    this.childWidgets.add(content);
    content.treeSetParent(this);
    };
    __ui_Tree.prototype.__class__.adopt = function() {
        return __ui_Tree.prototype.adopt.call.apply(__ui_Tree.prototype.adopt, arguments);
    };
    __ui_Tree.prototype.__class__.adopt.unbound_method = true;
    __ui_Tree.prototype.adopt.instance_method = true;
    __ui_Tree.prototype.disown = function(item) {
    this.childWidgets.remove(item);
    item.treeSetParent(null);
    };
    __ui_Tree.prototype.__class__.disown = function() {
        return __ui_Tree.prototype.disown.call.apply(__ui_Tree.prototype.disown, arguments);
    };
    __ui_Tree.prototype.__class__.disown.unbound_method = true;
    __ui_Tree.prototype.disown.instance_method = true;
    __ui_Tree.prototype.fireStateChanged = function(item) {

        var __listener = this.listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (pyjslib_hasattr(listener, 'onTreeItemStateChanged')) {
    listener.onTreeItemStateChanged(item);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Tree.prototype.__class__.fireStateChanged = function() {
        return __ui_Tree.prototype.fireStateChanged.call.apply(__ui_Tree.prototype.fireStateChanged, arguments);
    };
    __ui_Tree.prototype.__class__.fireStateChanged.unbound_method = true;
    __ui_Tree.prototype.fireStateChanged.instance_method = true;
    __ui_Tree.prototype.getChildWidgets = function() {
    return this.childWidgets;
    };
    __ui_Tree.prototype.__class__.getChildWidgets = function() {
        return __ui_Tree.prototype.getChildWidgets.call.apply(__ui_Tree.prototype.getChildWidgets, arguments);
    };
    __ui_Tree.prototype.__class__.getChildWidgets.unbound_method = true;
    __ui_Tree.prototype.getChildWidgets.instance_method = true;
    __ui_Tree.prototype.shouldTreeDelegateFocusToElement = function(elem) {

        var focus = ((elem.nodeName == "SELECT") || (elem.nodeName == "INPUT")  || (elem.nodeName == "CHECKBOX"));
        return focus;
        
    };
    __ui_Tree.prototype.__class__.shouldTreeDelegateFocusToElement = function() {
        return __ui_Tree.prototype.shouldTreeDelegateFocusToElement.call.apply(__ui_Tree.prototype.shouldTreeDelegateFocusToElement, arguments);
    };
    __ui_Tree.prototype.__class__.shouldTreeDelegateFocusToElement.unbound_method = true;
    __ui_Tree.prototype.shouldTreeDelegateFocusToElement.instance_method = true;
}
function __ui_FocusPanel() {
}
function ui_FocusPanel(child) {
    if (typeof child == 'undefined') child=null;
    var instance = new __ui_FocusPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_FocusPanel.parse_kwargs = function ( __kwargs, child ) {
    if (typeof child == 'undefined')
        child=__kwargs.child;
    var __r = [child];
    return __r;
};
function __ui_FocusPanel_initialize() {
    if(__ui_FocusPanel.__was_initialized__) return;
    __ui_FocusPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_FocusPanel, __ui_SimplePanel);
    __ui_FocusPanel.prototype.__class__.__new__ = ui_FocusPanel;
    __ui_FocusPanel.prototype.__init__ = function(child) {
    if (typeof child == 'undefined') child=null;
    this.clickListeners = new pyjslib_List([]);
    this.focusListeners = new pyjslib_List([]);
    this.keyboardListeners = new pyjslib_List([]);
    this.mouseListeners = new pyjslib_List([]);
    __ui_SimplePanel.prototype.__class__.__init__(this, __ui_Focus.prototype.__class__.createFocusable(this));
    this.sinkEvents((__ui_Event.prototype.__class__.FOCUSEVENTS | __ui_Event.prototype.__class__.KEYEVENTS | __ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.MOUSEEVENTS));
    if (child) {
    this.setWidget(child);
    }
    };
__ui_FocusPanel.prototype.__init__.parse_kwargs = function ( __kwargs, child ) {
    if (typeof child == 'undefined')
        child=__kwargs.child;
    var __r = [child];
    return __r;
};
    __ui_FocusPanel.prototype.__class__.__init__ = function() {
        return __ui_FocusPanel.prototype.__init__.call.apply(__ui_FocusPanel.prototype.__init__, arguments);
    };
    __ui_FocusPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_FocusPanel.prototype.__init__.instance_method = true;
    __ui_FocusPanel.prototype.__class__.__init__.parse_kwargs = __ui_FocusPanel.prototype.__init__.parse_kwargs;
    __ui_FocusPanel.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_FocusPanel.prototype.__class__.addClickListener = function() {
        return __ui_FocusPanel.prototype.addClickListener.call.apply(__ui_FocusPanel.prototype.addClickListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.addClickListener.unbound_method = true;
    __ui_FocusPanel.prototype.addClickListener.instance_method = true;
    __ui_FocusPanel.prototype.addFocusListener = function(listener) {
    this.focusListeners.append(listener);
    };
    __ui_FocusPanel.prototype.__class__.addFocusListener = function() {
        return __ui_FocusPanel.prototype.addFocusListener.call.apply(__ui_FocusPanel.prototype.addFocusListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.addFocusListener.unbound_method = true;
    __ui_FocusPanel.prototype.addFocusListener.instance_method = true;
    __ui_FocusPanel.prototype.addKeyboardListener = function(listener) {
    this.keyboardListeners.append(listener);
    };
    __ui_FocusPanel.prototype.__class__.addKeyboardListener = function() {
        return __ui_FocusPanel.prototype.addKeyboardListener.call.apply(__ui_FocusPanel.prototype.addKeyboardListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.addKeyboardListener.unbound_method = true;
    __ui_FocusPanel.prototype.addKeyboardListener.instance_method = true;
    __ui_FocusPanel.prototype.addMouseListener = function(listener) {
    this.mouseListeners.append(listener);
    };
    __ui_FocusPanel.prototype.__class__.addMouseListener = function() {
        return __ui_FocusPanel.prototype.addMouseListener.call.apply(__ui_FocusPanel.prototype.addMouseListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.addMouseListener.unbound_method = true;
    __ui_FocusPanel.prototype.addMouseListener.instance_method = true;
    __ui_FocusPanel.prototype.getTabIndex = function() {
    return __ui_Focus.prototype.__class__.getTabIndex(this, this.getElement());
    };
    __ui_FocusPanel.prototype.__class__.getTabIndex = function() {
        return __ui_FocusPanel.prototype.getTabIndex.call.apply(__ui_FocusPanel.prototype.getTabIndex, arguments);
    };
    __ui_FocusPanel.prototype.__class__.getTabIndex.unbound_method = true;
    __ui_FocusPanel.prototype.getTabIndex.instance_method = true;
    __ui_FocusPanel.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onClick) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if (((type == 'mousedown')) || ((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'mouseover')) || ((type == 'mouseout'))) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    }
    else if (((type == 'blur')) || ((type == 'focus'))) {
    __ui_FocusListener.prototype.__class__.fireFocusEvent(this, this.focusListeners, this, event);
    }
    else if (((type == 'keydown')) || ((type == 'keypress')) || ((type == 'keyup'))) {
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent(this, this.keyboardListeners, this, event);
    }
    };
    __ui_FocusPanel.prototype.__class__.onBrowserEvent = function() {
        return __ui_FocusPanel.prototype.onBrowserEvent.call.apply(__ui_FocusPanel.prototype.onBrowserEvent, arguments);
    };
    __ui_FocusPanel.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_FocusPanel.prototype.onBrowserEvent.instance_method = true;
    __ui_FocusPanel.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_FocusPanel.prototype.__class__.removeClickListener = function() {
        return __ui_FocusPanel.prototype.removeClickListener.call.apply(__ui_FocusPanel.prototype.removeClickListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_FocusPanel.prototype.removeClickListener.instance_method = true;
    __ui_FocusPanel.prototype.removeFocusListener = function(listener) {
    this.focusListeners.remove(listener);
    };
    __ui_FocusPanel.prototype.__class__.removeFocusListener = function() {
        return __ui_FocusPanel.prototype.removeFocusListener.call.apply(__ui_FocusPanel.prototype.removeFocusListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.removeFocusListener.unbound_method = true;
    __ui_FocusPanel.prototype.removeFocusListener.instance_method = true;
    __ui_FocusPanel.prototype.removeKeyboardListener = function(listener) {
    this.keyboardListeners.remove(listener);
    };
    __ui_FocusPanel.prototype.__class__.removeKeyboardListener = function() {
        return __ui_FocusPanel.prototype.removeKeyboardListener.call.apply(__ui_FocusPanel.prototype.removeKeyboardListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.removeKeyboardListener.unbound_method = true;
    __ui_FocusPanel.prototype.removeKeyboardListener.instance_method = true;
    __ui_FocusPanel.prototype.removeMouseListener = function(listener) {
    this.mouseListeners.remove(listener);
    };
    __ui_FocusPanel.prototype.__class__.removeMouseListener = function() {
        return __ui_FocusPanel.prototype.removeMouseListener.call.apply(__ui_FocusPanel.prototype.removeMouseListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.removeMouseListener.unbound_method = true;
    __ui_FocusPanel.prototype.removeMouseListener.instance_method = true;
    __ui_FocusPanel.prototype.setAccessKey = function(key) {
    __ui_Focus.prototype.__class__.setAccessKey(this, this.getElement(), key);
    };
    __ui_FocusPanel.prototype.__class__.setAccessKey = function() {
        return __ui_FocusPanel.prototype.setAccessKey.call.apply(__ui_FocusPanel.prototype.setAccessKey, arguments);
    };
    __ui_FocusPanel.prototype.__class__.setAccessKey.unbound_method = true;
    __ui_FocusPanel.prototype.setAccessKey.instance_method = true;
    __ui_FocusPanel.prototype.setFocus = function(focused) {
    if (focused) {
    __ui_Focus.prototype.__class__.focus(this, this.getElement());
    }
    else {
    __ui_Focus.prototype.__class__.blur(this, this.getElement());
    }
    };
    __ui_FocusPanel.prototype.__class__.setFocus = function() {
        return __ui_FocusPanel.prototype.setFocus.call.apply(__ui_FocusPanel.prototype.setFocus, arguments);
    };
    __ui_FocusPanel.prototype.__class__.setFocus.unbound_method = true;
    __ui_FocusPanel.prototype.setFocus.instance_method = true;
    __ui_FocusPanel.prototype.setTabIndex = function(index) {
    __ui_Focus.prototype.__class__.setTabIndex(this, this.getElement(), index);
    };
    __ui_FocusPanel.prototype.__class__.setTabIndex = function() {
        return __ui_FocusPanel.prototype.setTabIndex.call.apply(__ui_FocusPanel.prototype.setTabIndex, arguments);
    };
    __ui_FocusPanel.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_FocusPanel.prototype.setTabIndex.instance_method = true;
}
function __ui_Focus() {
}
function ui_Focus() {
    var instance = new __ui_Focus();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Focus_initialize() {
    if(__ui_Focus.__was_initialized__) return;
    __ui_Focus.__was_initialized__ = true;
    pyjs_extend(__ui_Focus, __pyjslib_Object);
    __ui_Focus.prototype.__class__.__new__ = ui_Focus;
    __ui_Focus.prototype.blur = function(elem) {

        elem.firstChild.blur();
        
    };
    __ui_Focus.prototype.__class__.blur = function() {
        return __ui_Focus.prototype.blur.call.apply(__ui_Focus.prototype.blur, arguments);
    };
    __ui_Focus.prototype.__class__.blur.unbound_method = true;
    __ui_Focus.prototype.blur.instance_method = true;
    __ui_Focus.prototype.createFocusable = function() {

        var div = $doc.createElement('div');
        var input = $doc.createElement('input');
        input.type = 'text';
        input.style.width = input.style.height = 0;
        input.style.zIndex = -1;
        input.style.position = 'absolute';

        input.addEventListener(
            'blur',
            function(evt) { if (this.parentNode.onblur) this.parentNode.onblur(evt); },
            false);

        input.addEventListener(
            'focus',
            function(evt) { if (this.parentNode.onfocus) this.parentNode.onfocus(evt); },
            false);

        div.addEventListener(
            'mousedown',
            function(evt) { this.firstChild.focus(); },
            false);
        
        div.appendChild(input);
        return div;
        
    };
    __ui_Focus.prototype.__class__.createFocusable = function() {
        return __ui_Focus.prototype.createFocusable.call.apply(__ui_Focus.prototype.createFocusable, arguments);
    };
    __ui_Focus.prototype.__class__.createFocusable.unbound_method = true;
    __ui_Focus.prototype.createFocusable.instance_method = true;
    __ui_Focus.prototype.focus = function(elem) {

        elem.firstChild.focus();
        
    };
    __ui_Focus.prototype.__class__.focus = function() {
        return __ui_Focus.prototype.focus.call.apply(__ui_Focus.prototype.focus, arguments);
    };
    __ui_Focus.prototype.__class__.focus.unbound_method = true;
    __ui_Focus.prototype.focus.instance_method = true;
    __ui_Focus.prototype.getTabIndex = function(elem) {

        return elem.firstChild.tabIndex;
        
    };
    __ui_Focus.prototype.__class__.getTabIndex = function() {
        return __ui_Focus.prototype.getTabIndex.call.apply(__ui_Focus.prototype.getTabIndex, arguments);
    };
    __ui_Focus.prototype.__class__.getTabIndex.unbound_method = true;
    __ui_Focus.prototype.getTabIndex.instance_method = true;
    __ui_Focus.prototype.setAccessKey = function(elem, key) {

        elem.firstChild.accessKey = key;
        
    };
    __ui_Focus.prototype.__class__.setAccessKey = function() {
        return __ui_Focus.prototype.setAccessKey.call.apply(__ui_Focus.prototype.setAccessKey, arguments);
    };
    __ui_Focus.prototype.__class__.setAccessKey.unbound_method = true;
    __ui_Focus.prototype.setAccessKey.instance_method = true;
    __ui_Focus.prototype.setTabIndex = function(elem, index) {

        elem.firstChild.tabIndex = index;
        
    };
    __ui_Focus.prototype.__class__.setTabIndex = function() {
        return __ui_Focus.prototype.setTabIndex.call.apply(__ui_Focus.prototype.setTabIndex, arguments);
    };
    __ui_Focus.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_Focus.prototype.setTabIndex.instance_method = true;
}
function __ui_FileUpload() {
}
function ui_FileUpload() {
    var instance = new __ui_FileUpload();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FileUpload_initialize() {
    if(__ui_FileUpload.__was_initialized__) return;
    __ui_FileUpload.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_FileUpload, __ui_Widget);
    __ui_FileUpload.prototype.__class__.__new__ = ui_FileUpload;
    __ui_FileUpload.prototype.__init__ = function() {
    __ui_Widget.prototype.__class__.__init__(this);
    this.setElement(DOM_createElement('input'));
    DOM_setAttribute(this.getElement(), 'type', 'file');
    this.setStyleName('gwt-FileUpload');
    };
    __ui_FileUpload.prototype.__class__.__init__ = function() {
        return __ui_FileUpload.prototype.__init__.call.apply(__ui_FileUpload.prototype.__init__, arguments);
    };
    __ui_FileUpload.prototype.__class__.__init__.unbound_method = true;
    __ui_FileUpload.prototype.__init__.instance_method = true;
    __ui_FileUpload.prototype.getFilename = function() {
    return DOM_getAttribute(this.getElement(), 'value');
    };
    __ui_FileUpload.prototype.__class__.getFilename = function() {
        return __ui_FileUpload.prototype.getFilename.call.apply(__ui_FileUpload.prototype.getFilename, arguments);
    };
    __ui_FileUpload.prototype.__class__.getFilename.unbound_method = true;
    __ui_FileUpload.prototype.getFilename.instance_method = true;
    __ui_FileUpload.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_FileUpload.prototype.__class__.getName = function() {
        return __ui_FileUpload.prototype.getName.call.apply(__ui_FileUpload.prototype.getName, arguments);
    };
    __ui_FileUpload.prototype.__class__.getName.unbound_method = true;
    __ui_FileUpload.prototype.getName.instance_method = true;
    __ui_FileUpload.prototype.setName = function(name) {
    DOM_setAttribute(this.getElement(), 'name', name);
    };
    __ui_FileUpload.prototype.__class__.setName = function() {
        return __ui_FileUpload.prototype.setName.call.apply(__ui_FileUpload.prototype.setName, arguments);
    };
    __ui_FileUpload.prototype.__class__.setName.unbound_method = true;
    __ui_FileUpload.prototype.setName.instance_method = true;
}
function __ui_Hidden() {
}
function ui_Hidden(name, value) {
    if (typeof name == 'undefined') name=null;
    if (typeof value == 'undefined') value=null;
    var instance = new __ui_Hidden();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Hidden.parse_kwargs = function ( __kwargs, name, value ) {
    if (typeof name == 'undefined')
        name=__kwargs.name;
    if (typeof value == 'undefined')
        value=__kwargs.value;
    var __r = [name, value];
    return __r;
};
function __ui_Hidden_initialize() {
    if(__ui_Hidden.__was_initialized__) return;
    __ui_Hidden.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Hidden, __ui_Widget);
    __ui_Hidden.prototype.__class__.__new__ = ui_Hidden;
    __ui_Hidden.prototype.__init__ = function(name, value) {
    if (typeof name == 'undefined') name=null;
    if (typeof value == 'undefined') value=null;
    __ui_Widget.prototype.__class__.__init__(this);
    var element = DOM_createElement('input');
    this.setElement(element);
    DOM_setAttribute(element, 'type', 'hidden');
    if ((name != null)) {
    this.setName(name);
    }
    if ((value != null)) {
    this.setValue(value);
    }
    };
__ui_Hidden.prototype.__init__.parse_kwargs = function ( __kwargs, name, value ) {
    if (typeof name == 'undefined')
        name=__kwargs.name;
    if (typeof value == 'undefined')
        value=__kwargs.value;
    var __r = [name, value];
    return __r;
};
    __ui_Hidden.prototype.__class__.__init__ = function() {
        return __ui_Hidden.prototype.__init__.call.apply(__ui_Hidden.prototype.__init__, arguments);
    };
    __ui_Hidden.prototype.__class__.__init__.unbound_method = true;
    __ui_Hidden.prototype.__init__.instance_method = true;
    __ui_Hidden.prototype.__class__.__init__.parse_kwargs = __ui_Hidden.prototype.__init__.parse_kwargs;
    __ui_Hidden.prototype.getDefaultValue = function() {
    return DOM_getAttribute(this.getElement(), 'defaultValue');
    };
    __ui_Hidden.prototype.__class__.getDefaultValue = function() {
        return __ui_Hidden.prototype.getDefaultValue.call.apply(__ui_Hidden.prototype.getDefaultValue, arguments);
    };
    __ui_Hidden.prototype.__class__.getDefaultValue.unbound_method = true;
    __ui_Hidden.prototype.getDefaultValue.instance_method = true;
    __ui_Hidden.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_Hidden.prototype.__class__.getName = function() {
        return __ui_Hidden.prototype.getName.call.apply(__ui_Hidden.prototype.getName, arguments);
    };
    __ui_Hidden.prototype.__class__.getName.unbound_method = true;
    __ui_Hidden.prototype.getName.instance_method = true;
    __ui_Hidden.prototype.getValue = function() {
    return DOM_getAttribute(this.getElement(), 'value');
    };
    __ui_Hidden.prototype.__class__.getValue = function() {
        return __ui_Hidden.prototype.getValue.call.apply(__ui_Hidden.prototype.getValue, arguments);
    };
    __ui_Hidden.prototype.__class__.getValue.unbound_method = true;
    __ui_Hidden.prototype.getValue.instance_method = true;
    __ui_Hidden.prototype.setDefaultValue = function(defaultValue) {
    DOM_setAttribute(this.getElement(), 'defaultValue', defaultValue);
    };
    __ui_Hidden.prototype.__class__.setDefaultValue = function() {
        return __ui_Hidden.prototype.setDefaultValue.call.apply(__ui_Hidden.prototype.setDefaultValue, arguments);
    };
    __ui_Hidden.prototype.__class__.setDefaultValue.unbound_method = true;
    __ui_Hidden.prototype.setDefaultValue.instance_method = true;
    __ui_Hidden.prototype.setName = function(name) {
    if ((name == null)) {
    console.error('Name cannot be null');
    }
    else if ((pyjslib_len(name) == 0)) {
    console.error('Name cannot be an empty string.');
    }
    DOM_setAttribute(this.getElement(), 'name', name);
    };
    __ui_Hidden.prototype.__class__.setName = function() {
        return __ui_Hidden.prototype.setName.call.apply(__ui_Hidden.prototype.setName, arguments);
    };
    __ui_Hidden.prototype.__class__.setName.unbound_method = true;
    __ui_Hidden.prototype.setName.instance_method = true;
    __ui_Hidden.prototype.setValue = function(value) {
    DOM_setAttribute(this.getElement(), 'value', value);
    };
    __ui_Hidden.prototype.__class__.setValue = function() {
        return __ui_Hidden.prototype.setValue.call.apply(__ui_Hidden.prototype.setValue, arguments);
    };
    __ui_Hidden.prototype.__class__.setValue.unbound_method = true;
    __ui_Hidden.prototype.setValue.instance_method = true;
}
function __ui_NamedFrame() {
}
function ui_NamedFrame(name) {
    var instance = new __ui_NamedFrame();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_NamedFrame_initialize() {
    if(__ui_NamedFrame.__was_initialized__) return;
    __ui_NamedFrame.__was_initialized__ = true;
    if(!__ui_Frame.__was_initialized__)
        __ui_Frame_initialize();
    pyjs_extend(__ui_NamedFrame, __ui_Frame);
    __ui_NamedFrame.prototype.__class__.__new__ = ui_NamedFrame;
    __ui_NamedFrame.prototype.__init__ = function(name) {
    __ui_Frame.prototype.__class__.__init__(this);
    var div = DOM_createDiv();
    DOM_setInnerHTML(div,  (  ( '<iframe name=\'' + name )  + '\'>' ) );
    var iframe = DOM_getFirstChild(div);
    this.setElement(iframe);
    };
    __ui_NamedFrame.prototype.__class__.__init__ = function() {
        return __ui_NamedFrame.prototype.__init__.call.apply(__ui_NamedFrame.prototype.__init__, arguments);
    };
    __ui_NamedFrame.prototype.__class__.__init__.unbound_method = true;
    __ui_NamedFrame.prototype.__init__.instance_method = true;
    __ui_NamedFrame.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_NamedFrame.prototype.__class__.getName = function() {
        return __ui_NamedFrame.prototype.getName.call.apply(__ui_NamedFrame.prototype.getName, arguments);
    };
    __ui_NamedFrame.prototype.__class__.getName.unbound_method = true;
    __ui_NamedFrame.prototype.getName.instance_method = true;
}
function __ui_EventObject() {
}
function ui_EventObject(source) {
    var instance = new __ui_EventObject();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_EventObject_initialize() {
    if(__ui_EventObject.__was_initialized__) return;
    __ui_EventObject.__was_initialized__ = true;
    pyjs_extend(__ui_EventObject, __pyjslib_Object);
    __ui_EventObject.prototype.__class__.__new__ = ui_EventObject;
    __ui_EventObject.prototype.__init__ = function(source) {
    this.source = source;
    };
    __ui_EventObject.prototype.__class__.__init__ = function() {
        return __ui_EventObject.prototype.__init__.call.apply(__ui_EventObject.prototype.__init__, arguments);
    };
    __ui_EventObject.prototype.__class__.__init__.unbound_method = true;
    __ui_EventObject.prototype.__init__.instance_method = true;
    __ui_EventObject.prototype.getSource = function() {
    return this.source;
    };
    __ui_EventObject.prototype.__class__.getSource = function() {
        return __ui_EventObject.prototype.getSource.call.apply(__ui_EventObject.prototype.getSource, arguments);
    };
    __ui_EventObject.prototype.__class__.getSource.unbound_method = true;
    __ui_EventObject.prototype.getSource.instance_method = true;
}
function __ui_FormSubmitEvent() {
}
function ui_FormSubmitEvent(source) {
    var instance = new __ui_FormSubmitEvent();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FormSubmitEvent_initialize() {
    if(__ui_FormSubmitEvent.__was_initialized__) return;
    __ui_FormSubmitEvent.__was_initialized__ = true;
    if(!__ui_EventObject.__was_initialized__)
        __ui_EventObject_initialize();
    pyjs_extend(__ui_FormSubmitEvent, __ui_EventObject);
    __ui_FormSubmitEvent.prototype.__class__.__new__ = ui_FormSubmitEvent;
    __ui_FormSubmitEvent.prototype.__init__ = function(source) {
    __ui_EventObject.prototype.__class__.__init__(this, source);
    this.cancel = false;
    };
    __ui_FormSubmitEvent.prototype.__class__.__init__ = function() {
        return __ui_FormSubmitEvent.prototype.__init__.call.apply(__ui_FormSubmitEvent.prototype.__init__, arguments);
    };
    __ui_FormSubmitEvent.prototype.__class__.__init__.unbound_method = true;
    __ui_FormSubmitEvent.prototype.__init__.instance_method = true;
    __ui_FormSubmitEvent.prototype.isCancelled = function() {
    return this.cancel;
    };
    __ui_FormSubmitEvent.prototype.__class__.isCancelled = function() {
        return __ui_FormSubmitEvent.prototype.isCancelled.call.apply(__ui_FormSubmitEvent.prototype.isCancelled, arguments);
    };
    __ui_FormSubmitEvent.prototype.__class__.isCancelled.unbound_method = true;
    __ui_FormSubmitEvent.prototype.isCancelled.instance_method = true;
    __ui_FormSubmitEvent.prototype.setCancelled = function(cancel) {
    this.cancel = cancel;
    };
    __ui_FormSubmitEvent.prototype.__class__.setCancelled = function() {
        return __ui_FormSubmitEvent.prototype.setCancelled.call.apply(__ui_FormSubmitEvent.prototype.setCancelled, arguments);
    };
    __ui_FormSubmitEvent.prototype.__class__.setCancelled.unbound_method = true;
    __ui_FormSubmitEvent.prototype.setCancelled.instance_method = true;
}
function __ui_FormSubmitCompleteEvent() {
}
function ui_FormSubmitCompleteEvent(source, results) {
    var instance = new __ui_FormSubmitCompleteEvent();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FormSubmitCompleteEvent_initialize() {
    if(__ui_FormSubmitCompleteEvent.__was_initialized__) return;
    __ui_FormSubmitCompleteEvent.__was_initialized__ = true;
    if(!__ui_EventObject.__was_initialized__)
        __ui_EventObject_initialize();
    pyjs_extend(__ui_FormSubmitCompleteEvent, __ui_EventObject);
    __ui_FormSubmitCompleteEvent.prototype.__class__.__new__ = ui_FormSubmitCompleteEvent;
    __ui_FormSubmitCompleteEvent.prototype.__init__ = function(source, results) {
    __ui_EventObject.prototype.__class__.__init__(this, source);
    this.results = results;
    };
    __ui_FormSubmitCompleteEvent.prototype.__class__.__init__ = function() {
        return __ui_FormSubmitCompleteEvent.prototype.__init__.call.apply(__ui_FormSubmitCompleteEvent.prototype.__init__, arguments);
    };
    __ui_FormSubmitCompleteEvent.prototype.__class__.__init__.unbound_method = true;
    __ui_FormSubmitCompleteEvent.prototype.__init__.instance_method = true;
    __ui_FormSubmitCompleteEvent.prototype.getResults = function() {
    return this.results;
    };
    __ui_FormSubmitCompleteEvent.prototype.__class__.getResults = function() {
        return __ui_FormSubmitCompleteEvent.prototype.getResults.call.apply(__ui_FormSubmitCompleteEvent.prototype.getResults, arguments);
    };
    __ui_FormSubmitCompleteEvent.prototype.__class__.getResults.unbound_method = true;
    __ui_FormSubmitCompleteEvent.prototype.getResults.instance_method = true;
}
    var ui_FormPanel_formId = 0;
function __ui_FormPanel() {
}
function ui_FormPanel(target) {
    if (typeof target == 'undefined') target=null;
    var instance = new __ui_FormPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_FormPanel.parse_kwargs = function ( __kwargs, target ) {
    if (typeof target == 'undefined')
        target=__kwargs.target;
    var __r = [target];
    return __r;
};
function __ui_FormPanel_initialize() {
    if(__ui_FormPanel.__was_initialized__) return;
    __ui_FormPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_FormPanel, __ui_SimplePanel);
    __ui_FormPanel.prototype.__class__.__new__ = ui_FormPanel;
    __ui_FormPanel.prototype.__class__.ENCODING_MULTIPART = 'multipart/form-data';
    __ui_FormPanel.prototype.__class__.ENCODING_URLENCODED = 'application/x-www-form-urlencoded';
    __ui_FormPanel.prototype.__class__.METHOD_GET = 'get';
    __ui_FormPanel.prototype.__class__.METHOD_POST = 'post';
    __ui_FormPanel.prototype.__init__ = function(target) {
    if (typeof target == 'undefined') target=null;
    if (pyjslib_hasattr(target, 'getName')) {
    var target = target.getName();
    }
    __ui_SimplePanel.prototype.__class__.__init__(this, DOM_createForm());
    this.formHandlers = new pyjslib_List([]);
    this.iframe = null;
    ui_FormPanel_formId += 1;
    var formName =  ( 'FormPanel_' + pyjslib_str(ui_FormPanel_formId) ) ;
    DOM_setAttribute(this.getElement(), 'target', formName);
    DOM_setInnerHTML(this.getElement(),  (  ( '<iframe name=\'' + formName )  + '\'>' ) );
    this.iframe = DOM_getFirstChild(this.getElement());
    DOM_setIntStyleAttribute(this.iframe, 'width', 0);
    DOM_setIntStyleAttribute(this.iframe, 'height', 0);
    DOM_setIntStyleAttribute(this.iframe, 'border', 0);
    this.sinkEvents(__ui_Event.prototype.__class__.ONLOAD);
    if ((target != null)) {
    this.setTarget(target);
    }
    };
__ui_FormPanel.prototype.__init__.parse_kwargs = function ( __kwargs, target ) {
    if (typeof target == 'undefined')
        target=__kwargs.target;
    var __r = [target];
    return __r;
};
    __ui_FormPanel.prototype.__class__.__init__ = function() {
        return __ui_FormPanel.prototype.__init__.call.apply(__ui_FormPanel.prototype.__init__, arguments);
    };
    __ui_FormPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_FormPanel.prototype.__init__.instance_method = true;
    __ui_FormPanel.prototype.__class__.__init__.parse_kwargs = __ui_FormPanel.prototype.__init__.parse_kwargs;
    __ui_FormPanel.prototype.addFormHandler = function(handler) {
    this.formHandlers.append(handler);
    };
    __ui_FormPanel.prototype.__class__.addFormHandler = function() {
        return __ui_FormPanel.prototype.addFormHandler.call.apply(__ui_FormPanel.prototype.addFormHandler, arguments);
    };
    __ui_FormPanel.prototype.__class__.addFormHandler.unbound_method = true;
    __ui_FormPanel.prototype.addFormHandler.instance_method = true;
    __ui_FormPanel.prototype.getAction = function() {
    return DOM_getAttribute(this.getElement(), 'action');
    };
    __ui_FormPanel.prototype.__class__.getAction = function() {
        return __ui_FormPanel.prototype.getAction.call.apply(__ui_FormPanel.prototype.getAction, arguments);
    };
    __ui_FormPanel.prototype.__class__.getAction.unbound_method = true;
    __ui_FormPanel.prototype.getAction.instance_method = true;
    __ui_FormPanel.prototype.getEncoding = function() {

        return this.getElement().enctype;
        
    };
    __ui_FormPanel.prototype.__class__.getEncoding = function() {
        return __ui_FormPanel.prototype.getEncoding.call.apply(__ui_FormPanel.prototype.getEncoding, arguments);
    };
    __ui_FormPanel.prototype.__class__.getEncoding.unbound_method = true;
    __ui_FormPanel.prototype.getEncoding.instance_method = true;
    __ui_FormPanel.prototype.getMethod = function() {
    return DOM_getAttribute(this.getElement(), 'method');
    };
    __ui_FormPanel.prototype.__class__.getMethod = function() {
        return __ui_FormPanel.prototype.getMethod.call.apply(__ui_FormPanel.prototype.getMethod, arguments);
    };
    __ui_FormPanel.prototype.__class__.getMethod.unbound_method = true;
    __ui_FormPanel.prototype.getMethod.instance_method = true;
    __ui_FormPanel.prototype.getTarget = function() {
    return DOM_getAttribute(this.getElement(), 'target');
    };
    __ui_FormPanel.prototype.__class__.getTarget = function() {
        return __ui_FormPanel.prototype.getTarget.call.apply(__ui_FormPanel.prototype.getTarget, arguments);
    };
    __ui_FormPanel.prototype.__class__.getTarget.unbound_method = true;
    __ui_FormPanel.prototype.getTarget.instance_method = true;
    __ui_FormPanel.prototype.getTextContents = function(iframe) {

        try {
            if (!iframe.contentWindow.document)
                return null;

            return iframe.contentWindow.document.body.innerHTML;
        } catch (e) {
            return null;
        }
        
    };
    __ui_FormPanel.prototype.__class__.getTextContents = function() {
        return __ui_FormPanel.prototype.getTextContents.call.apply(__ui_FormPanel.prototype.getTextContents, arguments);
    };
    __ui_FormPanel.prototype.__class__.getTextContents.unbound_method = true;
    __ui_FormPanel.prototype.getTextContents.instance_method = true;
    __ui_FormPanel.prototype.hookEvents = function(iframe, form, listener) {

        if (iframe) {
            iframe.onload = function() {
                if (!iframe.__formAction)
                    return;

                listener.onFrameLoad();
            };
        }

        form.onsubmit = function() {
            if (iframe)
                iframe.__formAction = form.action;
            return listener.onFormSubmit();
        };
        
    };
    __ui_FormPanel.prototype.__class__.hookEvents = function() {
        return __ui_FormPanel.prototype.hookEvents.call.apply(__ui_FormPanel.prototype.hookEvents, arguments);
    };
    __ui_FormPanel.prototype.__class__.hookEvents.unbound_method = true;
    __ui_FormPanel.prototype.hookEvents.instance_method = true;
    __ui_FormPanel.prototype.onFormSubmit = function() {
    var event = ui_FormSubmitEvent(this);

        var __handler = this.formHandlers.__iter__();
        try {
            while (true) {
                var handler = __handler.next();
                
        
    handler.onSubmit(event);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return !(event.isCancelled());
    };
    __ui_FormPanel.prototype.__class__.onFormSubmit = function() {
        return __ui_FormPanel.prototype.onFormSubmit.call.apply(__ui_FormPanel.prototype.onFormSubmit, arguments);
    };
    __ui_FormPanel.prototype.__class__.onFormSubmit.unbound_method = true;
    __ui_FormPanel.prototype.onFormSubmit.instance_method = true;
    __ui_FormPanel.prototype.onFrameLoad = function() {
    var event = ui_FormSubmitCompleteEvent(this, this.getTextContents(this.iframe));

        var __handler = this.formHandlers.__iter__();
        try {
            while (true) {
                var handler = __handler.next();
                
        
    handler.onSubmitComplete(event);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_FormPanel.prototype.__class__.onFrameLoad = function() {
        return __ui_FormPanel.prototype.onFrameLoad.call.apply(__ui_FormPanel.prototype.onFrameLoad, arguments);
    };
    __ui_FormPanel.prototype.__class__.onFrameLoad.unbound_method = true;
    __ui_FormPanel.prototype.onFrameLoad.instance_method = true;
    __ui_FormPanel.prototype.removeFormHandler = function(handler) {
    this.formHandlers.remove(handler);
    };
    __ui_FormPanel.prototype.__class__.removeFormHandler = function() {
        return __ui_FormPanel.prototype.removeFormHandler.call.apply(__ui_FormPanel.prototype.removeFormHandler, arguments);
    };
    __ui_FormPanel.prototype.__class__.removeFormHandler.unbound_method = true;
    __ui_FormPanel.prototype.removeFormHandler.instance_method = true;
    __ui_FormPanel.prototype.setAction = function(url) {
    DOM_setAttribute(this.getElement(), 'action', url);
    };
    __ui_FormPanel.prototype.__class__.setAction = function() {
        return __ui_FormPanel.prototype.setAction.call.apply(__ui_FormPanel.prototype.setAction, arguments);
    };
    __ui_FormPanel.prototype.__class__.setAction.unbound_method = true;
    __ui_FormPanel.prototype.setAction.instance_method = true;
    __ui_FormPanel.prototype.setEncoding = function(encodingType) {

        var form = this.getElement();
        form.enctype = encodingType;
        form.encoding = encodingType;
        
    };
    __ui_FormPanel.prototype.__class__.setEncoding = function() {
        return __ui_FormPanel.prototype.setEncoding.call.apply(__ui_FormPanel.prototype.setEncoding, arguments);
    };
    __ui_FormPanel.prototype.__class__.setEncoding.unbound_method = true;
    __ui_FormPanel.prototype.setEncoding.instance_method = true;
    __ui_FormPanel.prototype.setMethod = function(method) {
    DOM_setAttribute(this.getElement(), 'method', method);
    };
    __ui_FormPanel.prototype.__class__.setMethod = function() {
        return __ui_FormPanel.prototype.setMethod.call.apply(__ui_FormPanel.prototype.setMethod, arguments);
    };
    __ui_FormPanel.prototype.__class__.setMethod.unbound_method = true;
    __ui_FormPanel.prototype.setMethod.instance_method = true;
    __ui_FormPanel.prototype.submit = function() {
    var event = ui_FormSubmitEvent(this);

        var __handler = this.formHandlers.__iter__();
        try {
            while (true) {
                var handler = __handler.next();
                
        
    handler.onSubmit(event);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    if (event.isCancelled()) {
    return;
    }
    this.submitImpl(this.getElement(), this.iframe);
    };
    __ui_FormPanel.prototype.__class__.submit = function() {
        return __ui_FormPanel.prototype.submit.call.apply(__ui_FormPanel.prototype.submit, arguments);
    };
    __ui_FormPanel.prototype.__class__.submit.unbound_method = true;
    __ui_FormPanel.prototype.submit.instance_method = true;
    __ui_FormPanel.prototype.submitImpl = function(form, iframe) {

        if (iframe)
            iframe.__formAction = form.action;
        form.submit();
        
    };
    __ui_FormPanel.prototype.__class__.submitImpl = function() {
        return __ui_FormPanel.prototype.submitImpl.call.apply(__ui_FormPanel.prototype.submitImpl, arguments);
    };
    __ui_FormPanel.prototype.__class__.submitImpl.unbound_method = true;
    __ui_FormPanel.prototype.submitImpl.instance_method = true;
    __ui_FormPanel.prototype.onAttach = function() {
    __ui_SimplePanel.prototype.__class__.onAttach(this);
    this.hookEvents(this.iframe, this.getElement(), this);
    };
    __ui_FormPanel.prototype.__class__.onAttach = function() {
        return __ui_FormPanel.prototype.onAttach.call.apply(__ui_FormPanel.prototype.onAttach, arguments);
    };
    __ui_FormPanel.prototype.__class__.onAttach.unbound_method = true;
    __ui_FormPanel.prototype.onAttach.instance_method = true;
    __ui_FormPanel.prototype.onDetach = function() {
    __ui_SimplePanel.prototype.__class__.onDetach(this);
    this.unhookEvents(this.iframe, this.getElement());
    };
    __ui_FormPanel.prototype.__class__.onDetach = function() {
        return __ui_FormPanel.prototype.onDetach.call.apply(__ui_FormPanel.prototype.onDetach, arguments);
    };
    __ui_FormPanel.prototype.__class__.onDetach.unbound_method = true;
    __ui_FormPanel.prototype.onDetach.instance_method = true;
    __ui_FormPanel.prototype.setTarget = function(target) {
    DOM_setAttribute(this.getElement(), 'target', target);
    };
    __ui_FormPanel.prototype.__class__.setTarget = function() {
        return __ui_FormPanel.prototype.setTarget.call.apply(__ui_FormPanel.prototype.setTarget, arguments);
    };
    __ui_FormPanel.prototype.__class__.setTarget.unbound_method = true;
    __ui_FormPanel.prototype.setTarget.instance_method = true;
    __ui_FormPanel.prototype.unhookEvents = function(iframe, form) {

        if (iframe)
            iframe.onload = null;
        form.onsubmit = null;
        
    };
    __ui_FormPanel.prototype.__class__.unhookEvents = function() {
        return __ui_FormPanel.prototype.unhookEvents.call.apply(__ui_FormPanel.prototype.unhookEvents, arguments);
    };
    __ui_FormPanel.prototype.__class__.unhookEvents.unbound_method = true;
    __ui_FormPanel.prototype.unhookEvents.instance_method = true;
}
function __ui_ClickableHeader() {
}
function ui_ClickableHeader(disclosurePanel) {
    var instance = new __ui_ClickableHeader();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ClickableHeader_initialize() {
    if(__ui_ClickableHeader.__was_initialized__) return;
    __ui_ClickableHeader.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_ClickableHeader, __ui_SimplePanel);
    __ui_ClickableHeader.prototype.__class__.__new__ = ui_ClickableHeader;
    __ui_ClickableHeader.prototype.__init__ = function(disclosurePanel) {
    __ui_SimplePanel.prototype.__class__.__init__(this, DOM_createAnchor());
    this.disclosurePanel = disclosurePanel;
    var element = this.getElement();
    DOM_setStyleAttribute(element, 'display', 'block');
    this.sinkEvents(__ui_Event.prototype.__class__.ONCLICK);
    this.setStyleName('gwt-disclosurePanel-header');
    };
    __ui_ClickableHeader.prototype.__class__.__init__ = function() {
        return __ui_ClickableHeader.prototype.__init__.call.apply(__ui_ClickableHeader.prototype.__init__, arguments);
    };
    __ui_ClickableHeader.prototype.__class__.__init__.unbound_method = true;
    __ui_ClickableHeader.prototype.__init__.instance_method = true;
    __ui_ClickableHeader.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    DOM_eventPreventDefault(event);
    var currentState = this.disclosurePanel.getOpen();
    var invertedState = !(currentState);
    this.disclosurePanel.setOpen(invertedState);
    }
    };
    __ui_ClickableHeader.prototype.__class__.onBrowserEvent = function() {
        return __ui_ClickableHeader.prototype.onBrowserEvent.call.apply(__ui_ClickableHeader.prototype.onBrowserEvent, arguments);
    };
    __ui_ClickableHeader.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_ClickableHeader.prototype.onBrowserEvent.instance_method = true;
}
function __ui_DefaultHeader() {
}
function ui_DefaultHeader(text, disclosurePanel) {
    var instance = new __ui_DefaultHeader();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DefaultHeader_initialize() {
    if(__ui_DefaultHeader.__was_initialized__) return;
    __ui_DefaultHeader.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_DefaultHeader, __ui_Widget);
    __ui_DefaultHeader.prototype.__class__.__new__ = ui_DefaultHeader;
    __ui_DefaultHeader.prototype.__init__ = function(text, disclosurePanel) {
    this.disclosurePanel = disclosurePanel;
    this.imageBase = pygwt_getModuleBaseURL();
    this.root = DOM_createTable();
    this.tbody = DOM_createTBody();
    this.tr = DOM_createTR();
    this.imageTD = DOM_createTD();
    this.labelTD = DOM_createTD();
    this.imgElem = DOM_createImg();
    this.updateState();
    this.setElement(this.root);
    DOM_appendChild(this.root, this.tbody);
    DOM_appendChild(this.tbody, this.tr);
    DOM_appendChild(this.tr, this.imageTD);
    DOM_appendChild(this.tr, this.labelTD);
    DOM_appendChild(this.imageTD, this.imgElem);
    this.setText(text);
    };
    __ui_DefaultHeader.prototype.__class__.__init__ = function() {
        return __ui_DefaultHeader.prototype.__init__.call.apply(__ui_DefaultHeader.prototype.__init__, arguments);
    };
    __ui_DefaultHeader.prototype.__class__.__init__.unbound_method = true;
    __ui_DefaultHeader.prototype.__init__.instance_method = true;
    __ui_DefaultHeader.prototype.getText = function() {
    return DOM_getInnerText(this.labelTD);
    };
    __ui_DefaultHeader.prototype.__class__.getText = function() {
        return __ui_DefaultHeader.prototype.getText.call.apply(__ui_DefaultHeader.prototype.getText, arguments);
    };
    __ui_DefaultHeader.prototype.__class__.getText.unbound_method = true;
    __ui_DefaultHeader.prototype.getText.instance_method = true;
    __ui_DefaultHeader.prototype.setText = function(text) {
    DOM_setInnerText(this.labelTD, text);
    };
    __ui_DefaultHeader.prototype.__class__.setText = function() {
        return __ui_DefaultHeader.prototype.setText.call.apply(__ui_DefaultHeader.prototype.setText, arguments);
    };
    __ui_DefaultHeader.prototype.__class__.setText.unbound_method = true;
    __ui_DefaultHeader.prototype.setText.instance_method = true;
    __ui_DefaultHeader.prototype.updateState = function() {
    if (this.disclosurePanel.getOpen()) {
    DOM_setAttribute(this.imgElem, 'src',  ( this.imageBase + 'disclosurePanelOpen.png' ) );
    }
    else {
    DOM_setAttribute(this.imgElem, 'src',  ( this.imageBase + 'disclosurePanelClosed.png' ) );
    }
    };
    __ui_DefaultHeader.prototype.__class__.updateState = function() {
        return __ui_DefaultHeader.prototype.updateState.call.apply(__ui_DefaultHeader.prototype.updateState, arguments);
    };
    __ui_DefaultHeader.prototype.__class__.updateState.unbound_method = true;
    __ui_DefaultHeader.prototype.updateState.instance_method = true;
}
function __ui_DisclosurePanel() {
}
function ui_DisclosurePanel(headerText, isOpen) {
    var instance = new __ui_DisclosurePanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DisclosurePanel_initialize() {
    if(__ui_DisclosurePanel.__was_initialized__) return;
    __ui_DisclosurePanel.__was_initialized__ = true;
    if(!__ui_Composite.__was_initialized__)
        __ui_Composite_initialize();
    pyjs_extend(__ui_DisclosurePanel, __ui_Composite);
    __ui_DisclosurePanel.prototype.__class__.__new__ = ui_DisclosurePanel;
    __ui_DisclosurePanel.prototype.__init__ = function(headerText, isOpen) {
    this.mainPanel = ui_VerticalPanel();
    this.header = ui_ClickableHeader(this);
    this.contentWrapper = ui_SimplePanel();
    this.mainPanel.add(this.header);
    this.mainPanel.add(this.contentWrapper);
    this.isOpen = isOpen;
    this.headerObj = ui_DefaultHeader(headerText, this);
    this.setHeader(this.headerObj);
    this.setContentDisplay();
    this.initWidget(this.mainPanel);
    };
    __ui_DisclosurePanel.prototype.__class__.__init__ = function() {
        return __ui_DisclosurePanel.prototype.__init__.call.apply(__ui_DisclosurePanel.prototype.__init__, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.__init__.unbound_method = true;
    __ui_DisclosurePanel.prototype.__init__.instance_method = true;
    __ui_DisclosurePanel.prototype.add = function(widget) {
    if ((this.getContent() == null)) {
    this.setContent(widget);
    }
    };
    __ui_DisclosurePanel.prototype.__class__.add = function() {
        return __ui_DisclosurePanel.prototype.add.call.apply(__ui_DisclosurePanel.prototype.add, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.add.unbound_method = true;
    __ui_DisclosurePanel.prototype.add.instance_method = true;
    __ui_DisclosurePanel.prototype.clear = function() {
    this.setContent(null);
    };
    __ui_DisclosurePanel.prototype.__class__.clear = function() {
        return __ui_DisclosurePanel.prototype.clear.call.apply(__ui_DisclosurePanel.prototype.clear, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.clear.unbound_method = true;
    __ui_DisclosurePanel.prototype.clear.instance_method = true;
    __ui_DisclosurePanel.prototype.getContent = function() {
    return this.content;
    };
    __ui_DisclosurePanel.prototype.__class__.getContent = function() {
        return __ui_DisclosurePanel.prototype.getContent.call.apply(__ui_DisclosurePanel.prototype.getContent, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.getContent.unbound_method = true;
    __ui_DisclosurePanel.prototype.getContent.instance_method = true;
    __ui_DisclosurePanel.prototype.getHeader = function() {
    return this.header.getWidget();
    };
    __ui_DisclosurePanel.prototype.__class__.getHeader = function() {
        return __ui_DisclosurePanel.prototype.getHeader.call.apply(__ui_DisclosurePanel.prototype.getHeader, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.getHeader.unbound_method = true;
    __ui_DisclosurePanel.prototype.getHeader.instance_method = true;
    __ui_DisclosurePanel.prototype.getOpen = function() {
    return this.isOpen;
    };
    __ui_DisclosurePanel.prototype.__class__.getOpen = function() {
        return __ui_DisclosurePanel.prototype.getOpen.call.apply(__ui_DisclosurePanel.prototype.getOpen, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.getOpen.unbound_method = true;
    __ui_DisclosurePanel.prototype.getOpen.instance_method = true;
    __ui_DisclosurePanel.prototype.remove = function(widget) {
    if ((widget == this.getContent())) {
    this.setContent(null);
    return true;
    }
    return false;
    };
    __ui_DisclosurePanel.prototype.__class__.remove = function() {
        return __ui_DisclosurePanel.prototype.remove.call.apply(__ui_DisclosurePanel.prototype.remove, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.remove.unbound_method = true;
    __ui_DisclosurePanel.prototype.remove.instance_method = true;
    __ui_DisclosurePanel.prototype.setContent = function(widget) {
    if ((this.content != null)) {
    this.contentWrapper.setWidget(null);
    }
    this.content = widget;
    if ((this.content != null)) {
    this.contentWrapper.setWidget(this.content);
    }
    };
    __ui_DisclosurePanel.prototype.__class__.setContent = function() {
        return __ui_DisclosurePanel.prototype.setContent.call.apply(__ui_DisclosurePanel.prototype.setContent, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.setContent.unbound_method = true;
    __ui_DisclosurePanel.prototype.setContent.instance_method = true;
    __ui_DisclosurePanel.prototype.setHeader = function(widget) {
    this.header.setWidget(widget);
    };
    __ui_DisclosurePanel.prototype.__class__.setHeader = function() {
        return __ui_DisclosurePanel.prototype.setHeader.call.apply(__ui_DisclosurePanel.prototype.setHeader, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.setHeader.unbound_method = true;
    __ui_DisclosurePanel.prototype.setHeader.instance_method = true;
    __ui_DisclosurePanel.prototype.setOpen = function(isOpen) {
    if ((this.isOpen != isOpen)) {
    this.isOpen = isOpen;
    }
    this.setContentDisplay();
    };
    __ui_DisclosurePanel.prototype.__class__.setOpen = function() {
        return __ui_DisclosurePanel.prototype.setOpen.call.apply(__ui_DisclosurePanel.prototype.setOpen, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.setOpen.unbound_method = true;
    __ui_DisclosurePanel.prototype.setOpen.instance_method = true;
    __ui_DisclosurePanel.prototype.setContentDisplay = function() {
    this.contentWrapper.setVisible(this.isOpen);
    this.headerObj.updateState();
    };
    __ui_DisclosurePanel.prototype.__class__.setContentDisplay = function() {
        return __ui_DisclosurePanel.prototype.setContentDisplay.call.apply(__ui_DisclosurePanel.prototype.setContentDisplay, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.setContentDisplay.unbound_method = true;
    __ui_DisclosurePanel.prototype.setContentDisplay.instance_method = true;
}
__ui_RootTreeItem_initialize();
__ui_CheckBox_initialize();
__ui_NamedFrame_initialize();
__ui_FileUpload_initialize();
__ui_Label_initialize();
__ui_KeyboardListener_initialize();
__ui_DockPanel_initialize();
__ui_EventObject_initialize();
__ui_FormSubmitEvent_initialize();
__ui_TextBoxBase_initialize();
__ui_Hidden_initialize();
__ui_TreeContentPanel_initialize();
__ui_DialogBox_initialize();
__ui_MenuBar_initialize();
__ui_Widget_initialize();
__ui_FlowPanel_initialize();
__ui_FlexCellFormatter_initialize();
__ui_HorizontalPanel_initialize();
__ui_TextArea_initialize();
__ui_Composite_initialize();
__ui_RowFormatter_initialize();
__ui_UIObject_initialize();
__ui_FormPanel_initialize();
__ui_DefaultHeader_initialize();
__ui_ClickableHeader_initialize();
__ui_PasswordTextBox_initialize();
__ui_HTML_initialize();
__ui_Grid_initialize();
__ui_FocusWidget_initialize();
__ui_FocusPanel_initialize();
__ui_HasHorizontalAlignment_initialize();
__ui_DeckPanel_initialize();
__ui_Frame_initialize();
__ui_Panel_initialize();
__ui_HasAlignment_initialize();
__ui_SimplePanel_initialize();
__ui_VerticalPanel_initialize();
__ui_Hyperlink_initialize();
__ui_StackPanel_initialize();
__ui_Button_initialize();
__ui_Tree_initialize();
__ui_ScrollPanel_initialize();
__ui_ComplexPanel_initialize();
__ui_TabPanel_initialize();
__ui_TabBar_initialize();
__ui_CellPanel_initialize();
__ui_DisclosurePanel_initialize();
__ui_PopupPanel_initialize();
__ui_DockPanelTmpRow_initialize();
__ui_ListBox_initialize();
__ui_FocusListener_initialize();
__ui_TextBox_initialize();
__ui_FlexTable_initialize();
__ui_CellFormatter_initialize();
__ui_LayoutData_initialize();
__ui_HasVerticalAlignment_initialize();
__ui_Image_initialize();
__ui_MouseListener_initialize();
__ui_RadioButton_initialize();
__ui_HTMLPanel_initialize();
__ui_Event_initialize();
__ui_ButtonBase_initialize();
__ui_Focus_initialize();
__ui_TreeItem_initialize();
__ui_RootPanelCls_initialize();
__ui_MenuBarPopupPanel_initialize();
__ui_MenuItem_initialize();
__ui_FormSubmitCompleteEvent_initialize();
__ui_HTMLTable_initialize();
__ui_AbsolutePanel_initialize();
__ui_ClickDelegatePanel_initialize();
function __ui_Event() {
}
function ui_Event() {
    var instance = new __ui_Event();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Event_initialize() {
    if(__ui_Event.__was_initialized__) return;
    __ui_Event.__was_initialized__ = true;
    pyjs_extend(__ui_Event, __pyjslib_Object);
    __ui_Event.prototype.__class__.__new__ = ui_Event;
    __ui_Event.prototype.__class__.BUTTON_LEFT = 1;
    __ui_Event.prototype.__class__.BUTTON_MIDDLE = 4;
    __ui_Event.prototype.__class__.BUTTON_RIGHT = 2;
    __ui_Event.prototype.__class__.ONBLUR = 4096;
    __ui_Event.prototype.__class__.ONCHANGE = 1024;
    __ui_Event.prototype.__class__.ONCLICK = 1;
    __ui_Event.prototype.__class__.ONDBLCLICK = 2;
    __ui_Event.prototype.__class__.ONERROR = 65536;
    __ui_Event.prototype.__class__.ONFOCUS = 2048;
    __ui_Event.prototype.__class__.ONKEYDOWN = 128;
    __ui_Event.prototype.__class__.ONKEYPRESS = 256;
    __ui_Event.prototype.__class__.ONKEYUP = 512;
    __ui_Event.prototype.__class__.ONLOAD = 32768;
    __ui_Event.prototype.__class__.ONLOSECAPTURE = 8192;
    __ui_Event.prototype.__class__.ONMOUSEDOWN = 4;
    __ui_Event.prototype.__class__.ONMOUSEMOVE = 64;
    __ui_Event.prototype.__class__.ONMOUSEOUT = 32;
    __ui_Event.prototype.__class__.ONMOUSEOVER = 16;
    __ui_Event.prototype.__class__.ONMOUSEUP = 8;
    __ui_Event.prototype.__class__.ONSCROLL = 16384;
    __ui_Event.prototype.__class__.FOCUSEVENTS = 6144;
    __ui_Event.prototype.__class__.KEYEVENTS = 896;
    __ui_Event.prototype.__class__.MOUSEEVENTS = 124;
}
function __ui_FocusListener() {
}
function ui_FocusListener() {
    var instance = new __ui_FocusListener();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FocusListener_initialize() {
    if(__ui_FocusListener.__was_initialized__) return;
    __ui_FocusListener.__was_initialized__ = true;
    pyjs_extend(__ui_FocusListener, __pyjslib_Object);
    __ui_FocusListener.prototype.__class__.__new__ = ui_FocusListener;
    __ui_FocusListener.prototype.fireFocusEvent = function(listeners, sender, event) {
    var type = DOM_eventGetType(event);
    if ((type == 'focus')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onFocus(sender);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'blur')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onLostFocus(sender);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_FocusListener.prototype.__class__.fireFocusEvent = function() {
        return __ui_FocusListener.prototype.fireFocusEvent.call.apply(__ui_FocusListener.prototype.fireFocusEvent, arguments);
    };
    __ui_FocusListener.prototype.__class__.fireFocusEvent.unbound_method = true;
    __ui_FocusListener.prototype.fireFocusEvent.instance_method = true;
}
function __ui_KeyboardListener() {
}
function ui_KeyboardListener() {
    var instance = new __ui_KeyboardListener();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_KeyboardListener_initialize() {
    if(__ui_KeyboardListener.__was_initialized__) return;
    __ui_KeyboardListener.__was_initialized__ = true;
    pyjs_extend(__ui_KeyboardListener, __pyjslib_Object);
    __ui_KeyboardListener.prototype.__class__.__new__ = ui_KeyboardListener;
    __ui_KeyboardListener.prototype.__class__.KEY_ALT = 18;
    __ui_KeyboardListener.prototype.__class__.KEY_BACKSPACE = 8;
    __ui_KeyboardListener.prototype.__class__.KEY_CTRL = 17;
    __ui_KeyboardListener.prototype.__class__.KEY_DELETE = 46;
    __ui_KeyboardListener.prototype.__class__.KEY_DOWN = 40;
    __ui_KeyboardListener.prototype.__class__.KEY_END = 35;
    __ui_KeyboardListener.prototype.__class__.KEY_ENTER = 13;
    __ui_KeyboardListener.prototype.__class__.KEY_ESCAPE = 27;
    __ui_KeyboardListener.prototype.__class__.KEY_HOME = 36;
    __ui_KeyboardListener.prototype.__class__.KEY_LEFT = 37;
    __ui_KeyboardListener.prototype.__class__.KEY_PAGEDOWN = 34;
    __ui_KeyboardListener.prototype.__class__.KEY_PAGEUP = 33;
    __ui_KeyboardListener.prototype.__class__.KEY_RIGHT = 39;
    __ui_KeyboardListener.prototype.__class__.KEY_SHIFT = 16;
    __ui_KeyboardListener.prototype.__class__.KEY_TAB = 9;
    __ui_KeyboardListener.prototype.__class__.KEY_UP = 38;
    __ui_KeyboardListener.prototype.__class__.MODIFIER_ALT = 4;
    __ui_KeyboardListener.prototype.__class__.MODIFIER_CTRL = 2;
    __ui_KeyboardListener.prototype.__class__.MODIFIER_SHIFT = 1;
    __ui_KeyboardListener.prototype.getKeyboardModifiers = function(event) {
    var shift = 0;
    var ctrl = 0;
    var alt = 0;
    if (DOM_eventGetShiftKey(event)) {
    var shift = __ui_KeyboardListener.prototype.__class__.MODIFIER_SHIFT;
    }
    if (DOM_eventGetCtrlKey(event)) {
    var ctrl = __ui_KeyboardListener.prototype.__class__.MODIFIER_CTRL;
    }
    if (DOM_eventGetAltKey(event)) {
    var alt = __ui_KeyboardListener.prototype.__class__.MODIFIER_ALT;
    }
    return (shift | ctrl | alt);
    };
    __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers = function() {
        return __ui_KeyboardListener.prototype.getKeyboardModifiers.call.apply(__ui_KeyboardListener.prototype.getKeyboardModifiers, arguments);
    };
    __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers.unbound_method = true;
    __ui_KeyboardListener.prototype.getKeyboardModifiers.instance_method = true;
    __ui_KeyboardListener.prototype.fireKeyboardEvent = function(listeners, sender, event) {
    var modifiers = __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers(this, event);
    var type = DOM_eventGetType(event);
    if ((type == 'keydown')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onKeyDown(sender, DOM_eventGetKeyCode(event), modifiers);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'keyup')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onKeyUp(sender, DOM_eventGetKeyCode(event), modifiers);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'keypress')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onKeyPress(sender, DOM_eventGetKeyCode(event), modifiers);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent = function() {
        return __ui_KeyboardListener.prototype.fireKeyboardEvent.call.apply(__ui_KeyboardListener.prototype.fireKeyboardEvent, arguments);
    };
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent.unbound_method = true;
    __ui_KeyboardListener.prototype.fireKeyboardEvent.instance_method = true;
}
function __ui_MouseListener() {
}
function ui_MouseListener() {
    var instance = new __ui_MouseListener();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_MouseListener_initialize() {
    if(__ui_MouseListener.__was_initialized__) return;
    __ui_MouseListener.__was_initialized__ = true;
    pyjs_extend(__ui_MouseListener, __pyjslib_Object);
    __ui_MouseListener.prototype.__class__.__new__ = ui_MouseListener;
    __ui_MouseListener.prototype.fireMouseEvent = function(listeners, sender, event) {
    var x =  ( DOM_eventGetClientX(event) - DOM_getAbsoluteLeft(sender.getElement()) ) ;
    var y =  ( DOM_eventGetClientY(event) - DOM_getAbsoluteTop(sender.getElement()) ) ;
    var type = DOM_eventGetType(event);
    if ((type == 'mousedown')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseDown(sender, x, y);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'mouseup')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseUp(sender, x, y);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'mousemove')) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseMove(sender, x, y);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'mouseover')) {
    var from_element = DOM_eventGetFromElement(event);
    if (!(DOM_isOrHasChild(sender.getElement(), from_element))) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseEnter(sender);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    }
    else if ((type == 'mouseout')) {
    var to_element = DOM_eventGetToElement(event);
    if (!(DOM_isOrHasChild(sender.getElement(), to_element))) {

        var __listener = listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onMouseLeave(sender);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    }
    };
    __ui_MouseListener.prototype.__class__.fireMouseEvent = function() {
        return __ui_MouseListener.prototype.fireMouseEvent.call.apply(__ui_MouseListener.prototype.fireMouseEvent, arguments);
    };
    __ui_MouseListener.prototype.__class__.fireMouseEvent.unbound_method = true;
    __ui_MouseListener.prototype.fireMouseEvent.instance_method = true;
}
function __ui_UIObject() {
}
function ui_UIObject() {
    var instance = new __ui_UIObject();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_UIObject_initialize() {
    if(__ui_UIObject.__was_initialized__) return;
    __ui_UIObject.__was_initialized__ = true;
    pyjs_extend(__ui_UIObject, __pyjslib_Object);
    __ui_UIObject.prototype.__class__.__new__ = ui_UIObject;
    __ui_UIObject.prototype.getAbsoluteLeft = function() {
    return DOM_getAbsoluteLeft(this.getElement());
    };
    __ui_UIObject.prototype.__class__.getAbsoluteLeft = function() {
        return __ui_UIObject.prototype.getAbsoluteLeft.call.apply(__ui_UIObject.prototype.getAbsoluteLeft, arguments);
    };
    __ui_UIObject.prototype.__class__.getAbsoluteLeft.unbound_method = true;
    __ui_UIObject.prototype.getAbsoluteLeft.instance_method = true;
    __ui_UIObject.prototype.getAbsoluteTop = function() {
    return DOM_getAbsoluteTop(this.getElement());
    };
    __ui_UIObject.prototype.__class__.getAbsoluteTop = function() {
        return __ui_UIObject.prototype.getAbsoluteTop.call.apply(__ui_UIObject.prototype.getAbsoluteTop, arguments);
    };
    __ui_UIObject.prototype.__class__.getAbsoluteTop.unbound_method = true;
    __ui_UIObject.prototype.getAbsoluteTop.instance_method = true;
    __ui_UIObject.prototype.getElement = function() {
    return this.element;
    };
    __ui_UIObject.prototype.__class__.getElement = function() {
        return __ui_UIObject.prototype.getElement.call.apply(__ui_UIObject.prototype.getElement, arguments);
    };
    __ui_UIObject.prototype.__class__.getElement.unbound_method = true;
    __ui_UIObject.prototype.getElement.instance_method = true;
    __ui_UIObject.prototype.getOffsetHeight = function() {
    return DOM_getIntAttribute(this.element, 'offsetHeight');
    };
    __ui_UIObject.prototype.__class__.getOffsetHeight = function() {
        return __ui_UIObject.prototype.getOffsetHeight.call.apply(__ui_UIObject.prototype.getOffsetHeight, arguments);
    };
    __ui_UIObject.prototype.__class__.getOffsetHeight.unbound_method = true;
    __ui_UIObject.prototype.getOffsetHeight.instance_method = true;
    __ui_UIObject.prototype.getOffsetWidth = function() {
    return DOM_getIntAttribute(this.element, 'offsetWidth');
    };
    __ui_UIObject.prototype.__class__.getOffsetWidth = function() {
        return __ui_UIObject.prototype.getOffsetWidth.call.apply(__ui_UIObject.prototype.getOffsetWidth, arguments);
    };
    __ui_UIObject.prototype.__class__.getOffsetWidth.unbound_method = true;
    __ui_UIObject.prototype.getOffsetWidth.instance_method = true;
    __ui_UIObject.prototype.getStyleName = function() {
    return DOM_getAttribute(this.element, 'className');
    };
    __ui_UIObject.prototype.__class__.getStyleName = function() {
        return __ui_UIObject.prototype.getStyleName.call.apply(__ui_UIObject.prototype.getStyleName, arguments);
    };
    __ui_UIObject.prototype.__class__.getStyleName.unbound_method = true;
    __ui_UIObject.prototype.getStyleName.instance_method = true;
    __ui_UIObject.prototype.getTitle = function() {
    return DOM_getAttribute(this.element, 'title');
    };
    __ui_UIObject.prototype.__class__.getTitle = function() {
        return __ui_UIObject.prototype.getTitle.call.apply(__ui_UIObject.prototype.getTitle, arguments);
    };
    __ui_UIObject.prototype.__class__.getTitle.unbound_method = true;
    __ui_UIObject.prototype.getTitle.instance_method = true;
    __ui_UIObject.prototype.setElement = function(element) {
    this.element = element;
    };
    __ui_UIObject.prototype.__class__.setElement = function() {
        return __ui_UIObject.prototype.setElement.call.apply(__ui_UIObject.prototype.setElement, arguments);
    };
    __ui_UIObject.prototype.__class__.setElement.unbound_method = true;
    __ui_UIObject.prototype.setElement.instance_method = true;
    __ui_UIObject.prototype.setHeight = function(height) {
    DOM_setStyleAttribute(this.element, 'height', height);
    };
    __ui_UIObject.prototype.__class__.setHeight = function() {
        return __ui_UIObject.prototype.setHeight.call.apply(__ui_UIObject.prototype.setHeight, arguments);
    };
    __ui_UIObject.prototype.__class__.setHeight.unbound_method = true;
    __ui_UIObject.prototype.setHeight.instance_method = true;
    __ui_UIObject.prototype.getHeight = function() {
    return DOM_getStyleAttribute(this.element, 'height');
    };
    __ui_UIObject.prototype.__class__.getHeight = function() {
        return __ui_UIObject.prototype.getHeight.call.apply(__ui_UIObject.prototype.getHeight, arguments);
    };
    __ui_UIObject.prototype.__class__.getHeight.unbound_method = true;
    __ui_UIObject.prototype.getHeight.instance_method = true;
    __ui_UIObject.prototype.setPixelSize = function(width, height) {
    if ((width >= 0)) {
    this.setWidth( ( width + 'px' ) );
    }
    if ((height >= 0)) {
    this.setHeight( ( height + 'px' ) );
    }
    };
    __ui_UIObject.prototype.__class__.setPixelSize = function() {
        return __ui_UIObject.prototype.setPixelSize.call.apply(__ui_UIObject.prototype.setPixelSize, arguments);
    };
    __ui_UIObject.prototype.__class__.setPixelSize.unbound_method = true;
    __ui_UIObject.prototype.setPixelSize.instance_method = true;
    __ui_UIObject.prototype.setSize = function(width, height) {
    this.setWidth(width);
    this.setHeight(height);
    };
    __ui_UIObject.prototype.__class__.setSize = function() {
        return __ui_UIObject.prototype.setSize.call.apply(__ui_UIObject.prototype.setSize, arguments);
    };
    __ui_UIObject.prototype.__class__.setSize.unbound_method = true;
    __ui_UIObject.prototype.setSize.instance_method = true;
    __ui_UIObject.prototype.addStyleName = function(style) {
    this.setStyleName(this.element, style, true);
    };
    __ui_UIObject.prototype.__class__.addStyleName = function() {
        return __ui_UIObject.prototype.addStyleName.call.apply(__ui_UIObject.prototype.addStyleName, arguments);
    };
    __ui_UIObject.prototype.__class__.addStyleName.unbound_method = true;
    __ui_UIObject.prototype.addStyleName.instance_method = true;
    __ui_UIObject.prototype.removeStyleName = function(style) {
    this.setStyleName(this.element, style, false);
    };
    __ui_UIObject.prototype.__class__.removeStyleName = function() {
        return __ui_UIObject.prototype.removeStyleName.call.apply(__ui_UIObject.prototype.removeStyleName, arguments);
    };
    __ui_UIObject.prototype.__class__.removeStyleName.unbound_method = true;
    __ui_UIObject.prototype.removeStyleName.instance_method = true;
    __ui_UIObject.prototype.setStyleName = function(element, style, add) {
    if (typeof style == 'undefined') style=null;
    if (typeof add == 'undefined') add=true;
    if ((style == null)) {
    var style = element;
    DOM_setAttribute(this.element, 'className', style);
    return;
    }
    var oldStyle = DOM_getAttribute(element, 'className');
    if ((oldStyle == null)) {
    var oldStyle = '';
    }
    var idx = oldStyle.find(style);
    var lastPos = pyjslib_len(oldStyle);
    while ((idx != -1)) {
    if (((idx == 0)) || ((oldStyle.__getitem__( ( idx - 1 ) ) == ' '))) {
    var last =  ( idx + pyjslib_len(style) ) ;
    if (((last == lastPos)) || (((last < lastPos)) && ((oldStyle.__getitem__(last) == ' ')))) {
    break;
    }
    }
    var idx = oldStyle.find(style,  ( idx + 1 ) );
    }
    if (add) {
    if ((idx == -1)) {
    DOM_setAttribute(element, 'className',  (  ( oldStyle + ' ' )  + style ) );
    }
    }
    else {
    if ((idx != -1)) {
    var begin = pyjslib_slice(oldStyle, null, idx);
    var end = pyjslib_slice(oldStyle,  ( idx + pyjslib_len(style) ) , null);
    DOM_setAttribute(element, 'className',  ( begin + end ) );
    }
    }
    };
__ui_UIObject.prototype.setStyleName.parse_kwargs = function ( __kwargs, element, style, add ) {
    if (typeof style == 'undefined')
        style=__kwargs.style;
    if (typeof add == 'undefined')
        add=__kwargs.add;
    var __r = [element, style, add];
    return __r;
};
    __ui_UIObject.prototype.__class__.setStyleName = function() {
        return __ui_UIObject.prototype.setStyleName.call.apply(__ui_UIObject.prototype.setStyleName, arguments);
    };
    __ui_UIObject.prototype.__class__.setStyleName.unbound_method = true;
    __ui_UIObject.prototype.setStyleName.instance_method = true;
    __ui_UIObject.prototype.__class__.setStyleName.parse_kwargs = __ui_UIObject.prototype.setStyleName.parse_kwargs;
    __ui_UIObject.prototype.setTitle = function(title) {
    DOM_setAttribute(this.element, 'title', title);
    };
    __ui_UIObject.prototype.__class__.setTitle = function() {
        return __ui_UIObject.prototype.setTitle.call.apply(__ui_UIObject.prototype.setTitle, arguments);
    };
    __ui_UIObject.prototype.__class__.setTitle.unbound_method = true;
    __ui_UIObject.prototype.setTitle.instance_method = true;
    __ui_UIObject.prototype.setWidth = function(width) {
    DOM_setStyleAttribute(this.element, 'width', width);
    };
    __ui_UIObject.prototype.__class__.setWidth = function() {
        return __ui_UIObject.prototype.setWidth.call.apply(__ui_UIObject.prototype.setWidth, arguments);
    };
    __ui_UIObject.prototype.__class__.setWidth.unbound_method = true;
    __ui_UIObject.prototype.setWidth.instance_method = true;
    __ui_UIObject.prototype.getWidth = function() {
    return DOM_getStyleAttribute(this.element, 'width');
    };
    __ui_UIObject.prototype.__class__.getWidth = function() {
        return __ui_UIObject.prototype.getWidth.call.apply(__ui_UIObject.prototype.getWidth, arguments);
    };
    __ui_UIObject.prototype.__class__.getWidth.unbound_method = true;
    __ui_UIObject.prototype.getWidth.instance_method = true;
    __ui_UIObject.prototype.sinkEvents = function(eventBitsToAdd) {
    if (this.element) {
    DOM_sinkEvents(this.getElement(), (eventBitsToAdd | DOM_getEventsSunk(this.getElement())));
    }
    };
    __ui_UIObject.prototype.__class__.sinkEvents = function() {
        return __ui_UIObject.prototype.sinkEvents.call.apply(__ui_UIObject.prototype.sinkEvents, arguments);
    };
    __ui_UIObject.prototype.__class__.sinkEvents.unbound_method = true;
    __ui_UIObject.prototype.sinkEvents.instance_method = true;
    __ui_UIObject.prototype.setzIndex = function(index) {
    DOM_setIntStyleAttribute(this.element, 'zIndex', index);
    };
    __ui_UIObject.prototype.__class__.setzIndex = function() {
        return __ui_UIObject.prototype.setzIndex.call.apply(__ui_UIObject.prototype.setzIndex, arguments);
    };
    __ui_UIObject.prototype.__class__.setzIndex.unbound_method = true;
    __ui_UIObject.prototype.setzIndex.instance_method = true;
    __ui_UIObject.prototype.isVisible = function(element) {
    if (typeof element == 'undefined') element=null;
    if (!(element)) {
    var element = this.element;
    }
    return (element.style.display != 'none');
    };
__ui_UIObject.prototype.isVisible.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
    __ui_UIObject.prototype.__class__.isVisible = function() {
        return __ui_UIObject.prototype.isVisible.call.apply(__ui_UIObject.prototype.isVisible, arguments);
    };
    __ui_UIObject.prototype.__class__.isVisible.unbound_method = true;
    __ui_UIObject.prototype.isVisible.instance_method = true;
    __ui_UIObject.prototype.__class__.isVisible.parse_kwargs = __ui_UIObject.prototype.isVisible.parse_kwargs;
    __ui_UIObject.prototype.setVisible = function(element, visible) {
    if (typeof visible == 'undefined') visible=null;
    if ((visible == null)) {
    var visible = element;
    var element = this.element;
    }
    if (visible) {
    element.style.display = '';
    }
    else {
    element.style.display = 'none';
    }
    };
__ui_UIObject.prototype.setVisible.parse_kwargs = function ( __kwargs, element, visible ) {
    if (typeof visible == 'undefined')
        visible=__kwargs.visible;
    var __r = [element, visible];
    return __r;
};
    __ui_UIObject.prototype.__class__.setVisible = function() {
        return __ui_UIObject.prototype.setVisible.call.apply(__ui_UIObject.prototype.setVisible, arguments);
    };
    __ui_UIObject.prototype.__class__.setVisible.unbound_method = true;
    __ui_UIObject.prototype.setVisible.instance_method = true;
    __ui_UIObject.prototype.__class__.setVisible.parse_kwargs = __ui_UIObject.prototype.setVisible.parse_kwargs;
    __ui_UIObject.prototype.unsinkEvents = function(eventBitsToRemove) {
    DOM_sinkEvents(this.getElement(), (~eventBitsToRemove & DOM_getEventsSunk(this.getElement())));
    };
    __ui_UIObject.prototype.__class__.unsinkEvents = function() {
        return __ui_UIObject.prototype.unsinkEvents.call.apply(__ui_UIObject.prototype.unsinkEvents, arguments);
    };
    __ui_UIObject.prototype.__class__.unsinkEvents.unbound_method = true;
    __ui_UIObject.prototype.unsinkEvents.instance_method = true;
}
function __ui_Widget() {
}
function ui_Widget() {
    var instance = new __ui_Widget();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Widget_initialize() {
    if(__ui_Widget.__was_initialized__) return;
    __ui_Widget.__was_initialized__ = true;
    if(!__ui_UIObject.__was_initialized__)
        __ui_UIObject_initialize();
    pyjs_extend(__ui_Widget, __ui_UIObject);
    __ui_Widget.prototype.__class__.__new__ = ui_Widget;
    __ui_Widget.prototype.__init__ = function() {
    this.attached = false;
    this.parent = null;
    this.layoutData = null;
    };
    __ui_Widget.prototype.__class__.__init__ = function() {
        return __ui_Widget.prototype.__init__.call.apply(__ui_Widget.prototype.__init__, arguments);
    };
    __ui_Widget.prototype.__class__.__init__.unbound_method = true;
    __ui_Widget.prototype.__init__.instance_method = true;
    __ui_Widget.prototype.getLayoutData = function() {
    return this.layoutData;
    };
    __ui_Widget.prototype.__class__.getLayoutData = function() {
        return __ui_Widget.prototype.getLayoutData.call.apply(__ui_Widget.prototype.getLayoutData, arguments);
    };
    __ui_Widget.prototype.__class__.getLayoutData.unbound_method = true;
    __ui_Widget.prototype.getLayoutData.instance_method = true;
    __ui_Widget.prototype.getParent = function() {
    return this.parent;
    };
    __ui_Widget.prototype.__class__.getParent = function() {
        return __ui_Widget.prototype.getParent.call.apply(__ui_Widget.prototype.getParent, arguments);
    };
    __ui_Widget.prototype.__class__.getParent.unbound_method = true;
    __ui_Widget.prototype.getParent.instance_method = true;
    __ui_Widget.prototype.isAttached = function() {
    return this.attached;
    };
    __ui_Widget.prototype.__class__.isAttached = function() {
        return __ui_Widget.prototype.isAttached.call.apply(__ui_Widget.prototype.isAttached, arguments);
    };
    __ui_Widget.prototype.__class__.isAttached.unbound_method = true;
    __ui_Widget.prototype.isAttached.instance_method = true;
    __ui_Widget.prototype.onBrowserEvent = function(event) {
    };
    __ui_Widget.prototype.__class__.onBrowserEvent = function() {
        return __ui_Widget.prototype.onBrowserEvent.call.apply(__ui_Widget.prototype.onBrowserEvent, arguments);
    };
    __ui_Widget.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Widget.prototype.onBrowserEvent.instance_method = true;
    __ui_Widget.prototype.onLoad = function() {
    };
    __ui_Widget.prototype.__class__.onLoad = function() {
        return __ui_Widget.prototype.onLoad.call.apply(__ui_Widget.prototype.onLoad, arguments);
    };
    __ui_Widget.prototype.__class__.onLoad.unbound_method = true;
    __ui_Widget.prototype.onLoad.instance_method = true;
    __ui_Widget.prototype.doDetachChildren = function() {
    };
    __ui_Widget.prototype.__class__.doDetachChildren = function() {
        return __ui_Widget.prototype.doDetachChildren.call.apply(__ui_Widget.prototype.doDetachChildren, arguments);
    };
    __ui_Widget.prototype.__class__.doDetachChildren.unbound_method = true;
    __ui_Widget.prototype.doDetachChildren.instance_method = true;
    __ui_Widget.prototype.doAttachChildren = function() {
    };
    __ui_Widget.prototype.__class__.doAttachChildren = function() {
        return __ui_Widget.prototype.doAttachChildren.call.apply(__ui_Widget.prototype.doAttachChildren, arguments);
    };
    __ui_Widget.prototype.__class__.doAttachChildren.unbound_method = true;
    __ui_Widget.prototype.doAttachChildren.instance_method = true;
    __ui_Widget.prototype.onAttach = function() {
    if (this.isAttached()) {
    return;
    }
    this.attached = true;
    DOM_setEventListener(this.getElement(), this);
    this.doAttachChildren();
    this.onLoad();
    };
    __ui_Widget.prototype.__class__.onAttach = function() {
        return __ui_Widget.prototype.onAttach.call.apply(__ui_Widget.prototype.onAttach, arguments);
    };
    __ui_Widget.prototype.__class__.onAttach.unbound_method = true;
    __ui_Widget.prototype.onAttach.instance_method = true;
    __ui_Widget.prototype.onDetach = function() {
    if (!(this.isAttached())) {
    return;
    }
    this.doDetachChildren();
    this.attached = false;
    DOM_setEventListener(this.getElement(), null);
    };
    __ui_Widget.prototype.__class__.onDetach = function() {
        return __ui_Widget.prototype.onDetach.call.apply(__ui_Widget.prototype.onDetach, arguments);
    };
    __ui_Widget.prototype.__class__.onDetach.unbound_method = true;
    __ui_Widget.prototype.onDetach.instance_method = true;
    __ui_Widget.prototype.setLayoutData = function(layoutData) {
    this.layoutData = layoutData;
    };
    __ui_Widget.prototype.__class__.setLayoutData = function() {
        return __ui_Widget.prototype.setLayoutData.call.apply(__ui_Widget.prototype.setLayoutData, arguments);
    };
    __ui_Widget.prototype.__class__.setLayoutData.unbound_method = true;
    __ui_Widget.prototype.setLayoutData.instance_method = true;
    __ui_Widget.prototype.setParent = function(parent) {
    var oldparent = this.parent;
    this.parent = parent;
    if ((parent == null)) {
    if (((oldparent != null)) && (oldparent.attached)) {
    this.onDetach();
    }
    }
    else if (parent.attached) {
    this.onAttach();
    }
    };
    __ui_Widget.prototype.__class__.setParent = function() {
        return __ui_Widget.prototype.setParent.call.apply(__ui_Widget.prototype.setParent, arguments);
    };
    __ui_Widget.prototype.__class__.setParent.unbound_method = true;
    __ui_Widget.prototype.setParent.instance_method = true;
    __ui_Widget.prototype.removeFromParent = function() {
    if (pyjslib_hasattr(this.parent, 'remove')) {
    this.parent.remove(this);
    }
    };
    __ui_Widget.prototype.__class__.removeFromParent = function() {
        return __ui_Widget.prototype.removeFromParent.call.apply(__ui_Widget.prototype.removeFromParent, arguments);
    };
    __ui_Widget.prototype.__class__.removeFromParent.unbound_method = true;
    __ui_Widget.prototype.removeFromParent.instance_method = true;
    __ui_Widget.prototype.getID = function() {
    return DOM_getAttribute(this.getElement(), 'id');
    };
    __ui_Widget.prototype.__class__.getID = function() {
        return __ui_Widget.prototype.getID.call.apply(__ui_Widget.prototype.getID, arguments);
    };
    __ui_Widget.prototype.__class__.getID.unbound_method = true;
    __ui_Widget.prototype.getID.instance_method = true;
    __ui_Widget.prototype.setID = function(id) {
    DOM_setAttribute(this.getElement(), 'id', id);
    };
    __ui_Widget.prototype.__class__.setID = function() {
        return __ui_Widget.prototype.setID.call.apply(__ui_Widget.prototype.setID, arguments);
    };
    __ui_Widget.prototype.__class__.setID.unbound_method = true;
    __ui_Widget.prototype.setID.instance_method = true;
}
function __ui_FocusWidget() {
}
function ui_FocusWidget(element) {
    var instance = new __ui_FocusWidget();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FocusWidget_initialize() {
    if(__ui_FocusWidget.__was_initialized__) return;
    __ui_FocusWidget.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_FocusWidget, __ui_Widget);
    __ui_FocusWidget.prototype.__class__.__new__ = ui_FocusWidget;
    __ui_FocusWidget.prototype.__init__ = function(element) {
    __ui_Widget.prototype.__class__.__init__(this);
    this.clickListeners = new pyjslib_List([]);
    this.focusListeners = new pyjslib_List([]);
    this.keyboardListeners = new pyjslib_List([]);
    this.setElement(element);
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.FOCUSEVENTS | __ui_Event.prototype.__class__.KEYEVENTS));
    };
    __ui_FocusWidget.prototype.__class__.__init__ = function() {
        return __ui_FocusWidget.prototype.__init__.call.apply(__ui_FocusWidget.prototype.__init__, arguments);
    };
    __ui_FocusWidget.prototype.__class__.__init__.unbound_method = true;
    __ui_FocusWidget.prototype.__init__.instance_method = true;
    __ui_FocusWidget.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_FocusWidget.prototype.__class__.addClickListener = function() {
        return __ui_FocusWidget.prototype.addClickListener.call.apply(__ui_FocusWidget.prototype.addClickListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.addClickListener.unbound_method = true;
    __ui_FocusWidget.prototype.addClickListener.instance_method = true;
    __ui_FocusWidget.prototype.addFocusListener = function(listener) {
    this.focusListeners.append(listener);
    };
    __ui_FocusWidget.prototype.__class__.addFocusListener = function() {
        return __ui_FocusWidget.prototype.addFocusListener.call.apply(__ui_FocusWidget.prototype.addFocusListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.addFocusListener.unbound_method = true;
    __ui_FocusWidget.prototype.addFocusListener.instance_method = true;
    __ui_FocusWidget.prototype.addKeyboardListener = function(listener) {
    this.keyboardListeners.append(listener);
    };
    __ui_FocusWidget.prototype.__class__.addKeyboardListener = function() {
        return __ui_FocusWidget.prototype.addKeyboardListener.call.apply(__ui_FocusWidget.prototype.addKeyboardListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.addKeyboardListener.unbound_method = true;
    __ui_FocusWidget.prototype.addKeyboardListener.instance_method = true;
    __ui_FocusWidget.prototype.getTabIndex = function() {
    return __ui_Focus.prototype.__class__.getTabIndex(this, this.getElement());
    };
    __ui_FocusWidget.prototype.__class__.getTabIndex = function() {
        return __ui_FocusWidget.prototype.getTabIndex.call.apply(__ui_FocusWidget.prototype.getTabIndex, arguments);
    };
    __ui_FocusWidget.prototype.__class__.getTabIndex.unbound_method = true;
    __ui_FocusWidget.prototype.getTabIndex.instance_method = true;
    __ui_FocusWidget.prototype.isEnabled = function() {
    return !(DOM_getBooleanAttribute(this.getElement(), 'disabled'));
    };
    __ui_FocusWidget.prototype.__class__.isEnabled = function() {
        return __ui_FocusWidget.prototype.isEnabled.call.apply(__ui_FocusWidget.prototype.isEnabled, arguments);
    };
    __ui_FocusWidget.prototype.__class__.isEnabled.unbound_method = true;
    __ui_FocusWidget.prototype.isEnabled.instance_method = true;
    __ui_FocusWidget.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (pyjslib_hasattr(listener, 'onClick')) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if (((type == 'blur')) || ((type == 'focus'))) {
    __ui_FocusListener.prototype.__class__.fireFocusEvent(this, this.focusListeners, this, event);
    }
    else if (((type == 'keydown')) || ((type == 'keypress')) || ((type == 'keyup'))) {
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent(this, this.keyboardListeners, this, event);
    }
    };
    __ui_FocusWidget.prototype.__class__.onBrowserEvent = function() {
        return __ui_FocusWidget.prototype.onBrowserEvent.call.apply(__ui_FocusWidget.prototype.onBrowserEvent, arguments);
    };
    __ui_FocusWidget.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_FocusWidget.prototype.onBrowserEvent.instance_method = true;
    __ui_FocusWidget.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_FocusWidget.prototype.__class__.removeClickListener = function() {
        return __ui_FocusWidget.prototype.removeClickListener.call.apply(__ui_FocusWidget.prototype.removeClickListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_FocusWidget.prototype.removeClickListener.instance_method = true;
    __ui_FocusWidget.prototype.removeFocusListener = function(listener) {
    this.focusListeners.remove(listener);
    };
    __ui_FocusWidget.prototype.__class__.removeFocusListener = function() {
        return __ui_FocusWidget.prototype.removeFocusListener.call.apply(__ui_FocusWidget.prototype.removeFocusListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.removeFocusListener.unbound_method = true;
    __ui_FocusWidget.prototype.removeFocusListener.instance_method = true;
    __ui_FocusWidget.prototype.removeKeyboardListener = function(listener) {
    this.keyboardListeners.remove(listener);
    };
    __ui_FocusWidget.prototype.__class__.removeKeyboardListener = function() {
        return __ui_FocusWidget.prototype.removeKeyboardListener.call.apply(__ui_FocusWidget.prototype.removeKeyboardListener, arguments);
    };
    __ui_FocusWidget.prototype.__class__.removeKeyboardListener.unbound_method = true;
    __ui_FocusWidget.prototype.removeKeyboardListener.instance_method = true;
    __ui_FocusWidget.prototype.setAccessKey = function(key) {
    DOM_setAttribute(this.getElement(), 'accessKey',  ( '' + key ) );
    };
    __ui_FocusWidget.prototype.__class__.setAccessKey = function() {
        return __ui_FocusWidget.prototype.setAccessKey.call.apply(__ui_FocusWidget.prototype.setAccessKey, arguments);
    };
    __ui_FocusWidget.prototype.__class__.setAccessKey.unbound_method = true;
    __ui_FocusWidget.prototype.setAccessKey.instance_method = true;
    __ui_FocusWidget.prototype.setEnabled = function(enabled) {
    DOM_setBooleanAttribute(this.getElement(), 'disabled', !(enabled));
    };
    __ui_FocusWidget.prototype.__class__.setEnabled = function() {
        return __ui_FocusWidget.prototype.setEnabled.call.apply(__ui_FocusWidget.prototype.setEnabled, arguments);
    };
    __ui_FocusWidget.prototype.__class__.setEnabled.unbound_method = true;
    __ui_FocusWidget.prototype.setEnabled.instance_method = true;
    __ui_FocusWidget.prototype.setFocus = function(focused) {
    if (focused) {
    __ui_Focus.prototype.__class__.focus(this, this.getElement());
    }
    else {
    __ui_Focus.prototype.__class__.blur(this, this.getElement());
    }
    };
    __ui_FocusWidget.prototype.__class__.setFocus = function() {
        return __ui_FocusWidget.prototype.setFocus.call.apply(__ui_FocusWidget.prototype.setFocus, arguments);
    };
    __ui_FocusWidget.prototype.__class__.setFocus.unbound_method = true;
    __ui_FocusWidget.prototype.setFocus.instance_method = true;
    __ui_FocusWidget.prototype.setTabIndex = function(index) {
    __ui_Focus.prototype.__class__.setTabIndex(this, this.getElement(), index);
    };
    __ui_FocusWidget.prototype.__class__.setTabIndex = function() {
        return __ui_FocusWidget.prototype.setTabIndex.call.apply(__ui_FocusWidget.prototype.setTabIndex, arguments);
    };
    __ui_FocusWidget.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_FocusWidget.prototype.setTabIndex.instance_method = true;
}
function __ui_ButtonBase() {
}
function ui_ButtonBase(element) {
    var instance = new __ui_ButtonBase();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ButtonBase_initialize() {
    if(__ui_ButtonBase.__was_initialized__) return;
    __ui_ButtonBase.__was_initialized__ = true;
    if(!__ui_FocusWidget.__was_initialized__)
        __ui_FocusWidget_initialize();
    pyjs_extend(__ui_ButtonBase, __ui_FocusWidget);
    __ui_ButtonBase.prototype.__class__.__new__ = ui_ButtonBase;
    __ui_ButtonBase.prototype.__init__ = function(element) {
    __ui_FocusWidget.prototype.__class__.__init__(this, element);
    };
    __ui_ButtonBase.prototype.__class__.__init__ = function() {
        return __ui_ButtonBase.prototype.__init__.call.apply(__ui_ButtonBase.prototype.__init__, arguments);
    };
    __ui_ButtonBase.prototype.__class__.__init__.unbound_method = true;
    __ui_ButtonBase.prototype.__init__.instance_method = true;
    __ui_ButtonBase.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.getElement());
    };
    __ui_ButtonBase.prototype.__class__.getHTML = function() {
        return __ui_ButtonBase.prototype.getHTML.call.apply(__ui_ButtonBase.prototype.getHTML, arguments);
    };
    __ui_ButtonBase.prototype.__class__.getHTML.unbound_method = true;
    __ui_ButtonBase.prototype.getHTML.instance_method = true;
    __ui_ButtonBase.prototype.getText = function() {
    return DOM_getInnerText(this.getElement());
    };
    __ui_ButtonBase.prototype.__class__.getText = function() {
        return __ui_ButtonBase.prototype.getText.call.apply(__ui_ButtonBase.prototype.getText, arguments);
    };
    __ui_ButtonBase.prototype.__class__.getText.unbound_method = true;
    __ui_ButtonBase.prototype.getText.instance_method = true;
    __ui_ButtonBase.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.getElement(), html);
    };
    __ui_ButtonBase.prototype.__class__.setHTML = function() {
        return __ui_ButtonBase.prototype.setHTML.call.apply(__ui_ButtonBase.prototype.setHTML, arguments);
    };
    __ui_ButtonBase.prototype.__class__.setHTML.unbound_method = true;
    __ui_ButtonBase.prototype.setHTML.instance_method = true;
    __ui_ButtonBase.prototype.setText = function(text) {
    DOM_setInnerText(this.getElement(), text);
    };
    __ui_ButtonBase.prototype.__class__.setText = function() {
        return __ui_ButtonBase.prototype.setText.call.apply(__ui_ButtonBase.prototype.setText, arguments);
    };
    __ui_ButtonBase.prototype.__class__.setText.unbound_method = true;
    __ui_ButtonBase.prototype.setText.instance_method = true;
}
function __ui_Button() {
}
function ui_Button(html, listener) {
    if (typeof html == 'undefined') html=null;
    if (typeof listener == 'undefined') listener=null;
    var instance = new __ui_Button();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Button.parse_kwargs = function ( __kwargs, html, listener ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    if (typeof listener == 'undefined')
        listener=__kwargs.listener;
    var __r = [html, listener];
    return __r;
};
function __ui_Button_initialize() {
    if(__ui_Button.__was_initialized__) return;
    __ui_Button.__was_initialized__ = true;
    if(!__ui_ButtonBase.__was_initialized__)
        __ui_ButtonBase_initialize();
    pyjs_extend(__ui_Button, __ui_ButtonBase);
    __ui_Button.prototype.__class__.__new__ = ui_Button;
    __ui_Button.prototype.__init__ = function(html, listener) {
    if (typeof html == 'undefined') html=null;
    if (typeof listener == 'undefined') listener=null;
    __ui_ButtonBase.prototype.__class__.__init__(this, DOM_createButton());
    this.adjustType(this.getElement());
    this.setStyleName('gwt-Button');
    if (html) {
    this.setHTML(html);
    }
    if (listener) {
    this.addClickListener(listener);
    }
    };
__ui_Button.prototype.__init__.parse_kwargs = function ( __kwargs, html, listener ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    if (typeof listener == 'undefined')
        listener=__kwargs.listener;
    var __r = [html, listener];
    return __r;
};
    __ui_Button.prototype.__class__.__init__ = function() {
        return __ui_Button.prototype.__init__.call.apply(__ui_Button.prototype.__init__, arguments);
    };
    __ui_Button.prototype.__class__.__init__.unbound_method = true;
    __ui_Button.prototype.__init__.instance_method = true;
    __ui_Button.prototype.__class__.__init__.parse_kwargs = __ui_Button.prototype.__init__.parse_kwargs;
    __ui_Button.prototype.adjustType = function(button) {

        if (button.type == 'submit') {
            try { button.setAttribute("type", "button"); } catch (e) { }
        }
        
    };
    __ui_Button.prototype.__class__.adjustType = function() {
        return __ui_Button.prototype.adjustType.call.apply(__ui_Button.prototype.adjustType, arguments);
    };
    __ui_Button.prototype.__class__.adjustType.unbound_method = true;
    __ui_Button.prototype.adjustType.instance_method = true;
    __ui_Button.prototype.click = function() {
    this.getElement().click();
    };
    __ui_Button.prototype.__class__.click = function() {
        return __ui_Button.prototype.click.call.apply(__ui_Button.prototype.click, arguments);
    };
    __ui_Button.prototype.__class__.click.unbound_method = true;
    __ui_Button.prototype.click.instance_method = true;
}
function __ui_CheckBox() {
}
function ui_CheckBox(label, asHTML) {
    if (typeof label == 'undefined') label=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    var instance = new __ui_CheckBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_CheckBox.parse_kwargs = function ( __kwargs, label, asHTML ) {
    if (typeof label == 'undefined')
        label=__kwargs.label;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [label, asHTML];
    return __r;
};
function __ui_CheckBox_initialize() {
    if(__ui_CheckBox.__was_initialized__) return;
    __ui_CheckBox.__was_initialized__ = true;
    if(!__ui_ButtonBase.__was_initialized__)
        __ui_ButtonBase_initialize();
    pyjs_extend(__ui_CheckBox, __ui_ButtonBase);
    __ui_CheckBox.prototype.__class__.__new__ = ui_CheckBox;
    __ui_CheckBox.prototype.__init__ = function(label, asHTML) {
    if (typeof label == 'undefined') label=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    this.initElement(DOM_createInputCheck());
    this.setStyleName('gwt-CheckBox');
    if (label) {
    if (asHTML) {
    this.setHTML(label);
    }
    else {
    this.setText(label);
    }
    }
    };
__ui_CheckBox.prototype.__init__.parse_kwargs = function ( __kwargs, label, asHTML ) {
    if (typeof label == 'undefined')
        label=__kwargs.label;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [label, asHTML];
    return __r;
};
    __ui_CheckBox.prototype.__class__.__init__ = function() {
        return __ui_CheckBox.prototype.__init__.call.apply(__ui_CheckBox.prototype.__init__, arguments);
    };
    __ui_CheckBox.prototype.__class__.__init__.unbound_method = true;
    __ui_CheckBox.prototype.__init__.instance_method = true;
    __ui_CheckBox.prototype.__class__.__init__.parse_kwargs = __ui_CheckBox.prototype.__init__.parse_kwargs;
    __ui_CheckBox.prototype.initElement = function(element) {
    __ui_ButtonBase.prototype.__class__.__init__(this, DOM_createSpan());
    this.inputElem = element;
    this.labelElem = DOM_createLabel();
    this.unsinkEvents((__ui_Event.prototype.__class__.FOCUSEVENTS | __ui_Event.prototype.__class__.ONCLICK));
    DOM_sinkEvents(this.inputElem, (__ui_Event.prototype.__class__.FOCUSEVENTS | __ui_Event.prototype.__class__.ONCLICK | DOM_getEventsSunk(this.inputElem)));
    DOM_appendChild(this.getElement(), this.inputElem);
    DOM_appendChild(this.getElement(), this.labelElem);
    var uid =  ( 'check' + this.getUniqueID() ) ;
    DOM_setAttribute(this.inputElem, 'id', uid);
    DOM_setAttribute(this.labelElem, 'htmlFor', uid);
    };
    __ui_CheckBox.prototype.__class__.initElement = function() {
        return __ui_CheckBox.prototype.initElement.call.apply(__ui_CheckBox.prototype.initElement, arguments);
    };
    __ui_CheckBox.prototype.__class__.initElement.unbound_method = true;
    __ui_CheckBox.prototype.initElement.instance_method = true;
    __ui_CheckBox.prototype.getUniqueID = function() {

        _CheckBox_unique_id++;
        return _CheckBox_unique_id;
        };
        var _CheckBox_unique_id=0;
        {
        
    };
    __ui_CheckBox.prototype.__class__.getUniqueID = function() {
        return __ui_CheckBox.prototype.getUniqueID.call.apply(__ui_CheckBox.prototype.getUniqueID, arguments);
    };
    __ui_CheckBox.prototype.__class__.getUniqueID.unbound_method = true;
    __ui_CheckBox.prototype.getUniqueID.instance_method = true;
    __ui_CheckBox.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.labelElem);
    };
    __ui_CheckBox.prototype.__class__.getHTML = function() {
        return __ui_CheckBox.prototype.getHTML.call.apply(__ui_CheckBox.prototype.getHTML, arguments);
    };
    __ui_CheckBox.prototype.__class__.getHTML.unbound_method = true;
    __ui_CheckBox.prototype.getHTML.instance_method = true;
    __ui_CheckBox.prototype.getName = function() {
    return DOM_getAttribute(this.inputElem, 'name');
    };
    __ui_CheckBox.prototype.__class__.getName = function() {
        return __ui_CheckBox.prototype.getName.call.apply(__ui_CheckBox.prototype.getName, arguments);
    };
    __ui_CheckBox.prototype.__class__.getName.unbound_method = true;
    __ui_CheckBox.prototype.getName.instance_method = true;
    __ui_CheckBox.prototype.getText = function() {
    return DOM_getInnerText(this.labelElem);
    };
    __ui_CheckBox.prototype.__class__.getText = function() {
        return __ui_CheckBox.prototype.getText.call.apply(__ui_CheckBox.prototype.getText, arguments);
    };
    __ui_CheckBox.prototype.__class__.getText.unbound_method = true;
    __ui_CheckBox.prototype.getText.instance_method = true;
    __ui_CheckBox.prototype.setChecked = function(checked) {
    DOM_setBooleanAttribute(this.inputElem, 'checked', checked);
    DOM_setBooleanAttribute(this.inputElem, 'defaultChecked', checked);
    };
    __ui_CheckBox.prototype.__class__.setChecked = function() {
        return __ui_CheckBox.prototype.setChecked.call.apply(__ui_CheckBox.prototype.setChecked, arguments);
    };
    __ui_CheckBox.prototype.__class__.setChecked.unbound_method = true;
    __ui_CheckBox.prototype.setChecked.instance_method = true;
    __ui_CheckBox.prototype.isChecked = function() {
    if (this.isAttached()) {
    var propName = 'checked';
    }
    else {
    var propName = 'defaultChecked';
    }
    return DOM_getBooleanAttribute(this.inputElem, propName);
    };
    __ui_CheckBox.prototype.__class__.isChecked = function() {
        return __ui_CheckBox.prototype.isChecked.call.apply(__ui_CheckBox.prototype.isChecked, arguments);
    };
    __ui_CheckBox.prototype.__class__.isChecked.unbound_method = true;
    __ui_CheckBox.prototype.isChecked.instance_method = true;
    __ui_CheckBox.prototype.isEnabled = function() {
    return !(DOM_getBooleanAttribute(this.inputElem, 'disabled'));
    };
    __ui_CheckBox.prototype.__class__.isEnabled = function() {
        return __ui_CheckBox.prototype.isEnabled.call.apply(__ui_CheckBox.prototype.isEnabled, arguments);
    };
    __ui_CheckBox.prototype.__class__.isEnabled.unbound_method = true;
    __ui_CheckBox.prototype.isEnabled.instance_method = true;
    __ui_CheckBox.prototype.setEnabled = function(enabled) {
    DOM_setBooleanAttribute(this.inputElem, 'disabled', !(enabled));
    };
    __ui_CheckBox.prototype.__class__.setEnabled = function() {
        return __ui_CheckBox.prototype.setEnabled.call.apply(__ui_CheckBox.prototype.setEnabled, arguments);
    };
    __ui_CheckBox.prototype.__class__.setEnabled.unbound_method = true;
    __ui_CheckBox.prototype.setEnabled.instance_method = true;
    __ui_CheckBox.prototype.setFocus = function(focused) {
    if (focused) {
    __ui_Focus.prototype.__class__.focus(this, this.inputElem);
    }
    else {
    __ui_Focus.prototype.__class__.blur(this, this.inputElem);
    }
    };
    __ui_CheckBox.prototype.__class__.setFocus = function() {
        return __ui_CheckBox.prototype.setFocus.call.apply(__ui_CheckBox.prototype.setFocus, arguments);
    };
    __ui_CheckBox.prototype.__class__.setFocus.unbound_method = true;
    __ui_CheckBox.prototype.setFocus.instance_method = true;
    __ui_CheckBox.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.labelElem, html);
    };
    __ui_CheckBox.prototype.__class__.setHTML = function() {
        return __ui_CheckBox.prototype.setHTML.call.apply(__ui_CheckBox.prototype.setHTML, arguments);
    };
    __ui_CheckBox.prototype.__class__.setHTML.unbound_method = true;
    __ui_CheckBox.prototype.setHTML.instance_method = true;
    __ui_CheckBox.prototype.setName = function(name) {
    DOM_setAttribute(this.inputElem, 'name', name);
    };
    __ui_CheckBox.prototype.__class__.setName = function() {
        return __ui_CheckBox.prototype.setName.call.apply(__ui_CheckBox.prototype.setName, arguments);
    };
    __ui_CheckBox.prototype.__class__.setName.unbound_method = true;
    __ui_CheckBox.prototype.setName.instance_method = true;
    __ui_CheckBox.prototype.setTabIndex = function(index) {
    __ui_Focus.prototype.__class__.setTabIndex(this, this.inputElem, index);
    };
    __ui_CheckBox.prototype.__class__.setTabIndex = function() {
        return __ui_CheckBox.prototype.setTabIndex.call.apply(__ui_CheckBox.prototype.setTabIndex, arguments);
    };
    __ui_CheckBox.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_CheckBox.prototype.setTabIndex.instance_method = true;
    __ui_CheckBox.prototype.setText = function(text) {
    DOM_setInnerText(this.labelElem, text);
    };
    __ui_CheckBox.prototype.__class__.setText = function() {
        return __ui_CheckBox.prototype.setText.call.apply(__ui_CheckBox.prototype.setText, arguments);
    };
    __ui_CheckBox.prototype.__class__.setText.unbound_method = true;
    __ui_CheckBox.prototype.setText.instance_method = true;
    __ui_CheckBox.prototype.onDetach = function() {
    this.setChecked(this.isChecked());
    __ui_ButtonBase.prototype.__class__.onDetach(this);
    };
    __ui_CheckBox.prototype.__class__.onDetach = function() {
        return __ui_CheckBox.prototype.onDetach.call.apply(__ui_CheckBox.prototype.onDetach, arguments);
    };
    __ui_CheckBox.prototype.__class__.onDetach.unbound_method = true;
    __ui_CheckBox.prototype.onDetach.instance_method = true;
}
function __ui_RadioButton() {
}
function ui_RadioButton(group, label, asHTML) {
    if (typeof label == 'undefined') label=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    var instance = new __ui_RadioButton();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_RadioButton.parse_kwargs = function ( __kwargs, group, label, asHTML ) {
    if (typeof label == 'undefined')
        label=__kwargs.label;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [group, label, asHTML];
    return __r;
};
function __ui_RadioButton_initialize() {
    if(__ui_RadioButton.__was_initialized__) return;
    __ui_RadioButton.__was_initialized__ = true;
    if(!__ui_CheckBox.__was_initialized__)
        __ui_CheckBox_initialize();
    pyjs_extend(__ui_RadioButton, __ui_CheckBox);
    __ui_RadioButton.prototype.__class__.__new__ = ui_RadioButton;
    __ui_RadioButton.prototype.__init__ = function(group, label, asHTML) {
    if (typeof label == 'undefined') label=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    this.initElement(DOM_createInputRadio(group));
    this.setStyleName('gwt-RadioButton');
    if (label) {
    if (asHTML) {
    this.setHTML(label);
    }
    else {
    this.setText(label);
    }
    }
    };
__ui_RadioButton.prototype.__init__.parse_kwargs = function ( __kwargs, group, label, asHTML ) {
    if (typeof label == 'undefined')
        label=__kwargs.label;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [group, label, asHTML];
    return __r;
};
    __ui_RadioButton.prototype.__class__.__init__ = function() {
        return __ui_RadioButton.prototype.__init__.call.apply(__ui_RadioButton.prototype.__init__, arguments);
    };
    __ui_RadioButton.prototype.__class__.__init__.unbound_method = true;
    __ui_RadioButton.prototype.__init__.instance_method = true;
    __ui_RadioButton.prototype.__class__.__init__.parse_kwargs = __ui_RadioButton.prototype.__init__.parse_kwargs;
}
function __ui_Composite() {
}
function ui_Composite() {
    var instance = new __ui_Composite();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Composite_initialize() {
    if(__ui_Composite.__was_initialized__) return;
    __ui_Composite.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Composite, __ui_Widget);
    __ui_Composite.prototype.__class__.__new__ = ui_Composite;
    __ui_Composite.prototype.__init__ = function() {
    __ui_Widget.prototype.__class__.__init__(this);
    this.widget = null;
    };
    __ui_Composite.prototype.__class__.__init__ = function() {
        return __ui_Composite.prototype.__init__.call.apply(__ui_Composite.prototype.__init__, arguments);
    };
    __ui_Composite.prototype.__class__.__init__.unbound_method = true;
    __ui_Composite.prototype.__init__.instance_method = true;
    __ui_Composite.prototype.initWidget = function(widget) {
    if ((this.widget != null)) {
    return;
    }
    widget.removeFromParent();
    this.setElement(widget.getElement());
    this.widget = widget;
    widget.setParent(this);
    };
    __ui_Composite.prototype.__class__.initWidget = function() {
        return __ui_Composite.prototype.initWidget.call.apply(__ui_Composite.prototype.initWidget, arguments);
    };
    __ui_Composite.prototype.__class__.initWidget.unbound_method = true;
    __ui_Composite.prototype.initWidget.instance_method = true;
    __ui_Composite.prototype.isAttached = function() {
    if (this.widget) {
    return this.widget.isAttached();
    }
    return false;
    };
    __ui_Composite.prototype.__class__.isAttached = function() {
        return __ui_Composite.prototype.isAttached.call.apply(__ui_Composite.prototype.isAttached, arguments);
    };
    __ui_Composite.prototype.__class__.isAttached.unbound_method = true;
    __ui_Composite.prototype.isAttached.instance_method = true;
    __ui_Composite.prototype.onAttach = function() {
    this.widget.onAttach();
    DOM_setEventListener(this.getElement(), this);
    this.onLoad();
    };
    __ui_Composite.prototype.__class__.onAttach = function() {
        return __ui_Composite.prototype.onAttach.call.apply(__ui_Composite.prototype.onAttach, arguments);
    };
    __ui_Composite.prototype.__class__.onAttach.unbound_method = true;
    __ui_Composite.prototype.onAttach.instance_method = true;
    __ui_Composite.prototype.onDetach = function() {
    this.widget.onDetach();
    };
    __ui_Composite.prototype.__class__.onDetach = function() {
        return __ui_Composite.prototype.onDetach.call.apply(__ui_Composite.prototype.onDetach, arguments);
    };
    __ui_Composite.prototype.__class__.onDetach.unbound_method = true;
    __ui_Composite.prototype.onDetach.instance_method = true;
    __ui_Composite.prototype.setWidget = function(widget) {
    this.initWidget(widget);
    };
    __ui_Composite.prototype.__class__.setWidget = function() {
        return __ui_Composite.prototype.setWidget.call.apply(__ui_Composite.prototype.setWidget, arguments);
    };
    __ui_Composite.prototype.__class__.setWidget.unbound_method = true;
    __ui_Composite.prototype.setWidget.instance_method = true;
    __ui_Composite.prototype.onBrowserEvent = function(event) {
    this.widget.onBrowserEvent(event);
    };
    __ui_Composite.prototype.__class__.onBrowserEvent = function() {
        return __ui_Composite.prototype.onBrowserEvent.call.apply(__ui_Composite.prototype.onBrowserEvent, arguments);
    };
    __ui_Composite.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Composite.prototype.onBrowserEvent.instance_method = true;
}
function __ui_Panel() {
}
function ui_Panel() {
    var instance = new __ui_Panel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Panel_initialize() {
    if(__ui_Panel.__was_initialized__) return;
    __ui_Panel.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Panel, __ui_Widget);
    __ui_Panel.prototype.__class__.__new__ = ui_Panel;
    __ui_Panel.prototype.__init__ = function() {
    __ui_Widget.prototype.__class__.__init__(this);
    this.children = new pyjslib_List([]);
    };
    __ui_Panel.prototype.__class__.__init__ = function() {
        return __ui_Panel.prototype.__init__.call.apply(__ui_Panel.prototype.__init__, arguments);
    };
    __ui_Panel.prototype.__class__.__init__.unbound_method = true;
    __ui_Panel.prototype.__init__.instance_method = true;
    __ui_Panel.prototype.add = function() {
    console.error('This panel does not support no-arg add()');
    };
    __ui_Panel.prototype.__class__.add = function() {
        return __ui_Panel.prototype.add.call.apply(__ui_Panel.prototype.add, arguments);
    };
    __ui_Panel.prototype.__class__.add.unbound_method = true;
    __ui_Panel.prototype.add.instance_method = true;
    __ui_Panel.prototype.clear = function() {
    var children = new pyjslib_List([]);

        var __child = this.children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    children.append(child);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

        var __child = children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    this.remove(child);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Panel.prototype.__class__.clear = function() {
        return __ui_Panel.prototype.clear.call.apply(__ui_Panel.prototype.clear, arguments);
    };
    __ui_Panel.prototype.__class__.clear.unbound_method = true;
    __ui_Panel.prototype.clear.instance_method = true;
    __ui_Panel.prototype.disown = function(widget) {
    if ((widget.getParent() != this)) {
    console.error('widget %o is not a child of this panel %o', widget, this);
    }
    else {
    var element = widget.getElement();
    widget.setParent(null);
    var parentElement = DOM_getParent(element);
    if (parentElement) {
    DOM_removeChild(parentElement, element);
    }
    }
    };
    __ui_Panel.prototype.__class__.disown = function() {
        return __ui_Panel.prototype.disown.call.apply(__ui_Panel.prototype.disown, arguments);
    };
    __ui_Panel.prototype.__class__.disown.unbound_method = true;
    __ui_Panel.prototype.disown.instance_method = true;
    __ui_Panel.prototype.adopt = function(widget, container) {
    if (container) {
    widget.removeFromParent();
    DOM_appendChild(container, widget.getElement());
    }
    widget.setParent(this);
    };
    __ui_Panel.prototype.__class__.adopt = function() {
        return __ui_Panel.prototype.adopt.call.apply(__ui_Panel.prototype.adopt, arguments);
    };
    __ui_Panel.prototype.__class__.adopt.unbound_method = true;
    __ui_Panel.prototype.adopt.instance_method = true;
    __ui_Panel.prototype.remove = function(widget) {
    };
    __ui_Panel.prototype.__class__.remove = function() {
        return __ui_Panel.prototype.remove.call.apply(__ui_Panel.prototype.remove, arguments);
    };
    __ui_Panel.prototype.__class__.remove.unbound_method = true;
    __ui_Panel.prototype.remove.instance_method = true;
    __ui_Panel.prototype.doAttachChildren = function() {

        var __child = this.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.onAttach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Panel.prototype.__class__.doAttachChildren = function() {
        return __ui_Panel.prototype.doAttachChildren.call.apply(__ui_Panel.prototype.doAttachChildren, arguments);
    };
    __ui_Panel.prototype.__class__.doAttachChildren.unbound_method = true;
    __ui_Panel.prototype.doAttachChildren.instance_method = true;
    __ui_Panel.prototype.doDetachChildren = function() {

        var __child = this.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.onDetach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Panel.prototype.__class__.doDetachChildren = function() {
        return __ui_Panel.prototype.doDetachChildren.call.apply(__ui_Panel.prototype.doDetachChildren, arguments);
    };
    __ui_Panel.prototype.__class__.doDetachChildren.unbound_method = true;
    __ui_Panel.prototype.doDetachChildren.instance_method = true;
    __ui_Panel.prototype.__iter__ = function() {
    return this.children.__iter__();
    };
    __ui_Panel.prototype.__class__.__iter__ = function() {
        return __ui_Panel.prototype.__iter__.call.apply(__ui_Panel.prototype.__iter__, arguments);
    };
    __ui_Panel.prototype.__class__.__iter__.unbound_method = true;
    __ui_Panel.prototype.__iter__.instance_method = true;
}
function __ui_CellFormatter() {
}
function ui_CellFormatter(outer) {
    var instance = new __ui_CellFormatter();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_CellFormatter_initialize() {
    if(__ui_CellFormatter.__was_initialized__) return;
    __ui_CellFormatter.__was_initialized__ = true;
    pyjs_extend(__ui_CellFormatter, __pyjslib_Object);
    __ui_CellFormatter.prototype.__class__.__new__ = ui_CellFormatter;
    __ui_CellFormatter.prototype.__init__ = function(outer) {
    this.outer = outer;
    };
    __ui_CellFormatter.prototype.__class__.__init__ = function() {
        return __ui_CellFormatter.prototype.__init__.call.apply(__ui_CellFormatter.prototype.__init__, arguments);
    };
    __ui_CellFormatter.prototype.__class__.__init__.unbound_method = true;
    __ui_CellFormatter.prototype.__init__.instance_method = true;
    __ui_CellFormatter.prototype.addStyleName = function(row, column, styleName) {
    this.outer.prepareCell(row, column);
    this.outer.setStyleName(this.getElement(row, column), styleName, true);
    };
    __ui_CellFormatter.prototype.__class__.addStyleName = function() {
        return __ui_CellFormatter.prototype.addStyleName.call.apply(__ui_CellFormatter.prototype.addStyleName, arguments);
    };
    __ui_CellFormatter.prototype.__class__.addStyleName.unbound_method = true;
    __ui_CellFormatter.prototype.addStyleName.instance_method = true;
    __ui_CellFormatter.prototype.getElement = function(row, column) {
    this.outer.checkCellBounds(row, column);
    return DOM_getChild(this.outer.rowFormatter.getRow(this.outer.bodyElem, row), column);
    };
    __ui_CellFormatter.prototype.__class__.getElement = function() {
        return __ui_CellFormatter.prototype.getElement.call.apply(__ui_CellFormatter.prototype.getElement, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getElement.unbound_method = true;
    __ui_CellFormatter.prototype.getElement.instance_method = true;
    __ui_CellFormatter.prototype.getStyleName = function(row, column) {
    return DOM_getAttribute(this.getElement(row, column), 'className');
    };
    __ui_CellFormatter.prototype.__class__.getStyleName = function() {
        return __ui_CellFormatter.prototype.getStyleName.call.apply(__ui_CellFormatter.prototype.getStyleName, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getStyleName.unbound_method = true;
    __ui_CellFormatter.prototype.getStyleName.instance_method = true;
    __ui_CellFormatter.prototype.isVisible = function(row, column) {
    var element = this.getElement(row, column);
    return this.outer.isVisible(element);
    };
    __ui_CellFormatter.prototype.__class__.isVisible = function() {
        return __ui_CellFormatter.prototype.isVisible.call.apply(__ui_CellFormatter.prototype.isVisible, arguments);
    };
    __ui_CellFormatter.prototype.__class__.isVisible.unbound_method = true;
    __ui_CellFormatter.prototype.isVisible.instance_method = true;
    __ui_CellFormatter.prototype.removeStyleName = function(row, column, styleName) {
    this.outer.checkCellBounds(row, column);
    this.outer.setStyleName(this.getElement(row, column), styleName, false);
    };
    __ui_CellFormatter.prototype.__class__.removeStyleName = function() {
        return __ui_CellFormatter.prototype.removeStyleName.call.apply(__ui_CellFormatter.prototype.removeStyleName, arguments);
    };
    __ui_CellFormatter.prototype.__class__.removeStyleName.unbound_method = true;
    __ui_CellFormatter.prototype.removeStyleName.instance_method = true;
    __ui_CellFormatter.prototype.setAlignment = function(row, column, hAlign, vAlign) {
    this.setHorizontalAlignment(row, column, hAlign);
    this.setVerticalAlignment(row, column, vAlign);
    };
    __ui_CellFormatter.prototype.__class__.setAlignment = function() {
        return __ui_CellFormatter.prototype.setAlignment.call.apply(__ui_CellFormatter.prototype.setAlignment, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setAlignment.unbound_method = true;
    __ui_CellFormatter.prototype.setAlignment.instance_method = true;
    __ui_CellFormatter.prototype.setHeight = function(row, column, height) {
    this.outer.prepareCell(row, column);
    var element = this.getCellElement(this.outer.bodyElem, row, column);
    DOM_setStyleAttribute(element, 'height', height);
    };
    __ui_CellFormatter.prototype.__class__.setHeight = function() {
        return __ui_CellFormatter.prototype.setHeight.call.apply(__ui_CellFormatter.prototype.setHeight, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setHeight.unbound_method = true;
    __ui_CellFormatter.prototype.setHeight.instance_method = true;
    __ui_CellFormatter.prototype.setHorizontalAlignment = function(row, column, align) {
    this.outer.prepareCell(row, column);
    var element = this.getCellElement(this.outer.bodyElem, row, column);
    DOM_setAttribute(element, 'align', align);
    };
    __ui_CellFormatter.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_CellFormatter.prototype.setHorizontalAlignment.call.apply(__ui_CellFormatter.prototype.setHorizontalAlignment, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_CellFormatter.prototype.setHorizontalAlignment.instance_method = true;
    __ui_CellFormatter.prototype.setStyleName = function(row, column, styleName) {
    this.outer.prepareCell(row, column);
    this.setAttr(row, column, 'className', styleName);
    };
    __ui_CellFormatter.prototype.__class__.setStyleName = function() {
        return __ui_CellFormatter.prototype.setStyleName.call.apply(__ui_CellFormatter.prototype.setStyleName, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setStyleName.unbound_method = true;
    __ui_CellFormatter.prototype.setStyleName.instance_method = true;
    __ui_CellFormatter.prototype.setVerticalAlignment = function(row, column, align) {
    this.outer.prepareCell(row, column);
    DOM_setStyleAttribute(this.getCellElement(this.outer.bodyElem, row, column), 'verticalAlign', align);
    };
    __ui_CellFormatter.prototype.__class__.setVerticalAlignment = function() {
        return __ui_CellFormatter.prototype.setVerticalAlignment.call.apply(__ui_CellFormatter.prototype.setVerticalAlignment, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setVerticalAlignment.unbound_method = true;
    __ui_CellFormatter.prototype.setVerticalAlignment.instance_method = true;
    __ui_CellFormatter.prototype.setVisible = function(row, column, visible) {
    var element = this.ensureElement(row, column);
    this.outer.setVisible(element, visible);
    };
    __ui_CellFormatter.prototype.__class__.setVisible = function() {
        return __ui_CellFormatter.prototype.setVisible.call.apply(__ui_CellFormatter.prototype.setVisible, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setVisible.unbound_method = true;
    __ui_CellFormatter.prototype.setVisible.instance_method = true;
    __ui_CellFormatter.prototype.setWidth = function(row, column, width) {
    this.outer.prepareCell(row, column);
    DOM_setStyleAttribute(this.getCellElement(this.outer.bodyElem, row, column), 'width', width);
    };
    __ui_CellFormatter.prototype.__class__.setWidth = function() {
        return __ui_CellFormatter.prototype.setWidth.call.apply(__ui_CellFormatter.prototype.setWidth, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setWidth.unbound_method = true;
    __ui_CellFormatter.prototype.setWidth.instance_method = true;
    __ui_CellFormatter.prototype.setWordWrap = function(row, column, wrap) {
    this.outer.prepareCell(row, column);
    if (wrap) {
    var wrap_str = '';
    }
    else {
    var wrap_str = 'nowrap';
    }
    DOM_setStyleAttribute(this.getElement(row, column), 'whiteSpace', wrap_str);
    };
    __ui_CellFormatter.prototype.__class__.setWordWrap = function() {
        return __ui_CellFormatter.prototype.setWordWrap.call.apply(__ui_CellFormatter.prototype.setWordWrap, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setWordWrap.unbound_method = true;
    __ui_CellFormatter.prototype.setWordWrap.instance_method = true;
    __ui_CellFormatter.prototype.getCellElement = function(table, row, col) {

        var out = table.rows[row].cells[col];
        return (out == null ? null : out);
        
    };
    __ui_CellFormatter.prototype.__class__.getCellElement = function() {
        return __ui_CellFormatter.prototype.getCellElement.call.apply(__ui_CellFormatter.prototype.getCellElement, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getCellElement.unbound_method = true;
    __ui_CellFormatter.prototype.getCellElement.instance_method = true;
    __ui_CellFormatter.prototype.getRawElement = function(row, column) {
    return this.getCellElement(this.outer.bodyElem, row, column);
    };
    __ui_CellFormatter.prototype.__class__.getRawElement = function() {
        return __ui_CellFormatter.prototype.getRawElement.call.apply(__ui_CellFormatter.prototype.getRawElement, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getRawElement.unbound_method = true;
    __ui_CellFormatter.prototype.getRawElement.instance_method = true;
    __ui_CellFormatter.prototype.ensureElement = function(row, column) {
    this.outer.prepareCell(row, column);
    return DOM_getChild(this.outer.rowFormatter.ensureElement(row), column);
    };
    __ui_CellFormatter.prototype.__class__.ensureElement = function() {
        return __ui_CellFormatter.prototype.ensureElement.call.apply(__ui_CellFormatter.prototype.ensureElement, arguments);
    };
    __ui_CellFormatter.prototype.__class__.ensureElement.unbound_method = true;
    __ui_CellFormatter.prototype.ensureElement.instance_method = true;
    __ui_CellFormatter.prototype.getStyleAttr = function(row, column, attr) {
    var elem = this.getElement(row, column);
    return DOM_getStyleAttribute(elem, attr);
    };
    __ui_CellFormatter.prototype.__class__.getStyleAttr = function() {
        return __ui_CellFormatter.prototype.getStyleAttr.call.apply(__ui_CellFormatter.prototype.getStyleAttr, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getStyleAttr.unbound_method = true;
    __ui_CellFormatter.prototype.getStyleAttr.instance_method = true;
    __ui_CellFormatter.prototype.setStyleAttr = function(row, column, attrName, value) {
    var elem = this.getElement(row, column);
    DOM_setStyleAttribute(elem, attrName, value);
    };
    __ui_CellFormatter.prototype.__class__.setStyleAttr = function() {
        return __ui_CellFormatter.prototype.setStyleAttr.call.apply(__ui_CellFormatter.prototype.setStyleAttr, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setStyleAttr.unbound_method = true;
    __ui_CellFormatter.prototype.setStyleAttr.instance_method = true;
    __ui_CellFormatter.prototype.getAttr = function(row, column, attr) {
    var elem = this.getElement(row, column);
    return DOM_getAttribute(elem, attr);
    };
    __ui_CellFormatter.prototype.__class__.getAttr = function() {
        return __ui_CellFormatter.prototype.getAttr.call.apply(__ui_CellFormatter.prototype.getAttr, arguments);
    };
    __ui_CellFormatter.prototype.__class__.getAttr.unbound_method = true;
    __ui_CellFormatter.prototype.getAttr.instance_method = true;
    __ui_CellFormatter.prototype.setAttr = function(row, column, attrName, value) {
    var elem = this.getElement(row, column);
    DOM_setAttribute(elem, attrName, value);
    };
    __ui_CellFormatter.prototype.__class__.setAttr = function() {
        return __ui_CellFormatter.prototype.setAttr.call.apply(__ui_CellFormatter.prototype.setAttr, arguments);
    };
    __ui_CellFormatter.prototype.__class__.setAttr.unbound_method = true;
    __ui_CellFormatter.prototype.setAttr.instance_method = true;
}
function __ui_RowFormatter() {
}
function ui_RowFormatter(outer) {
    var instance = new __ui_RowFormatter();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_RowFormatter_initialize() {
    if(__ui_RowFormatter.__was_initialized__) return;
    __ui_RowFormatter.__was_initialized__ = true;
    pyjs_extend(__ui_RowFormatter, __pyjslib_Object);
    __ui_RowFormatter.prototype.__class__.__new__ = ui_RowFormatter;
    __ui_RowFormatter.prototype.__init__ = function(outer) {
    this.outer = outer;
    };
    __ui_RowFormatter.prototype.__class__.__init__ = function() {
        return __ui_RowFormatter.prototype.__init__.call.apply(__ui_RowFormatter.prototype.__init__, arguments);
    };
    __ui_RowFormatter.prototype.__class__.__init__.unbound_method = true;
    __ui_RowFormatter.prototype.__init__.instance_method = true;
    __ui_RowFormatter.prototype.addStyleName = function(row, styleName) {
    this.outer.setStyleName(this.ensureElement(row), styleName, true);
    };
    __ui_RowFormatter.prototype.__class__.addStyleName = function() {
        return __ui_RowFormatter.prototype.addStyleName.call.apply(__ui_RowFormatter.prototype.addStyleName, arguments);
    };
    __ui_RowFormatter.prototype.__class__.addStyleName.unbound_method = true;
    __ui_RowFormatter.prototype.addStyleName.instance_method = true;
    __ui_RowFormatter.prototype.getElement = function(row) {
    this.outer.checkRowBounds(row);
    return this.getRow(this.outer.bodyElem, row);
    };
    __ui_RowFormatter.prototype.__class__.getElement = function() {
        return __ui_RowFormatter.prototype.getElement.call.apply(__ui_RowFormatter.prototype.getElement, arguments);
    };
    __ui_RowFormatter.prototype.__class__.getElement.unbound_method = true;
    __ui_RowFormatter.prototype.getElement.instance_method = true;
    __ui_RowFormatter.prototype.getStyleName = function(row) {
    return DOM_getAttribute(this.getElement(row), 'className');
    };
    __ui_RowFormatter.prototype.__class__.getStyleName = function() {
        return __ui_RowFormatter.prototype.getStyleName.call.apply(__ui_RowFormatter.prototype.getStyleName, arguments);
    };
    __ui_RowFormatter.prototype.__class__.getStyleName.unbound_method = true;
    __ui_RowFormatter.prototype.getStyleName.instance_method = true;
    __ui_RowFormatter.prototype.isVisible = function(row) {
    var element = this.getElement(row);
    return this.outer.isVisible(element);
    };
    __ui_RowFormatter.prototype.__class__.isVisible = function() {
        return __ui_RowFormatter.prototype.isVisible.call.apply(__ui_RowFormatter.prototype.isVisible, arguments);
    };
    __ui_RowFormatter.prototype.__class__.isVisible.unbound_method = true;
    __ui_RowFormatter.prototype.isVisible.instance_method = true;
    __ui_RowFormatter.prototype.removeStyleName = function(row, styleName) {
    this.outer.setStyleName(this.getElement(row), styleName, false);
    };
    __ui_RowFormatter.prototype.__class__.removeStyleName = function() {
        return __ui_RowFormatter.prototype.removeStyleName.call.apply(__ui_RowFormatter.prototype.removeStyleName, arguments);
    };
    __ui_RowFormatter.prototype.__class__.removeStyleName.unbound_method = true;
    __ui_RowFormatter.prototype.removeStyleName.instance_method = true;
    __ui_RowFormatter.prototype.setStyleName = function(row, styleName) {
    var elem = this.ensureElement(row);
    DOM_setAttribute(elem, 'className', styleName);
    };
    __ui_RowFormatter.prototype.__class__.setStyleName = function() {
        return __ui_RowFormatter.prototype.setStyleName.call.apply(__ui_RowFormatter.prototype.setStyleName, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setStyleName.unbound_method = true;
    __ui_RowFormatter.prototype.setStyleName.instance_method = true;
    __ui_RowFormatter.prototype.setVerticalAlign = function(row, align) {
    DOM_setStyleAttribute(this.ensureElement(row), 'verticalAlign', align);
    };
    __ui_RowFormatter.prototype.__class__.setVerticalAlign = function() {
        return __ui_RowFormatter.prototype.setVerticalAlign.call.apply(__ui_RowFormatter.prototype.setVerticalAlign, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setVerticalAlign.unbound_method = true;
    __ui_RowFormatter.prototype.setVerticalAlign.instance_method = true;
    __ui_RowFormatter.prototype.setVisible = function(row, visible) {
    var element = this.ensureElement(row);
    this.outer.setVisible(element, visible);
    };
    __ui_RowFormatter.prototype.__class__.setVisible = function() {
        return __ui_RowFormatter.prototype.setVisible.call.apply(__ui_RowFormatter.prototype.setVisible, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setVisible.unbound_method = true;
    __ui_RowFormatter.prototype.setVisible.instance_method = true;
    __ui_RowFormatter.prototype.ensureElement = function(row) {
    this.outer.prepareRow(row);
    return this.getRow(this.outer.bodyElem, row);
    };
    __ui_RowFormatter.prototype.__class__.ensureElement = function() {
        return __ui_RowFormatter.prototype.ensureElement.call.apply(__ui_RowFormatter.prototype.ensureElement, arguments);
    };
    __ui_RowFormatter.prototype.__class__.ensureElement.unbound_method = true;
    __ui_RowFormatter.prototype.ensureElement.instance_method = true;
    __ui_RowFormatter.prototype.getRow = function(element, row) {

        return element.rows[row];
        
    };
    __ui_RowFormatter.prototype.__class__.getRow = function() {
        return __ui_RowFormatter.prototype.getRow.call.apply(__ui_RowFormatter.prototype.getRow, arguments);
    };
    __ui_RowFormatter.prototype.__class__.getRow.unbound_method = true;
    __ui_RowFormatter.prototype.getRow.instance_method = true;
    __ui_RowFormatter.prototype.setStyleAttr = function(row, attrName, value) {
    var element = this.ensureElement(row);
    DOM_setStyleAttribute(element, attrName, value);
    };
    __ui_RowFormatter.prototype.__class__.setStyleAttr = function() {
        return __ui_RowFormatter.prototype.setStyleAttr.call.apply(__ui_RowFormatter.prototype.setStyleAttr, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setStyleAttr.unbound_method = true;
    __ui_RowFormatter.prototype.setStyleAttr.instance_method = true;
    __ui_RowFormatter.prototype.setAttr = function(row, attrName, value) {
    var element = this.ensureElement(row);
    DOM_setAttribute(element, attrName, value);
    };
    __ui_RowFormatter.prototype.__class__.setAttr = function() {
        return __ui_RowFormatter.prototype.setAttr.call.apply(__ui_RowFormatter.prototype.setAttr, arguments);
    };
    __ui_RowFormatter.prototype.__class__.setAttr.unbound_method = true;
    __ui_RowFormatter.prototype.setAttr.instance_method = true;
}
function __ui_HTMLTable() {
}
function ui_HTMLTable() {
    var instance = new __ui_HTMLTable();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HTMLTable_initialize() {
    if(__ui_HTMLTable.__was_initialized__) return;
    __ui_HTMLTable.__was_initialized__ = true;
    if(!__ui_Panel.__was_initialized__)
        __ui_Panel_initialize();
    pyjs_extend(__ui_HTMLTable, __ui_Panel);
    __ui_HTMLTable.prototype.__class__.__new__ = ui_HTMLTable;
    __ui_HTMLTable.prototype.__init__ = function() {
    __ui_Panel.prototype.__class__.__init__(this);
    this.cellFormatter = ui_CellFormatter(this);
    this.rowFormatter = ui_RowFormatter(this);
    this.tableListeners = new pyjslib_List([]);
    this.widgetMap = new pyjslib_Dict([]);
    this.tableElem = DOM_createTable();
    this.bodyElem = DOM_createTBody();
    DOM_appendChild(this.tableElem, this.bodyElem);
    this.setElement(this.tableElem);
    this.sinkEvents(__ui_Event.prototype.__class__.ONCLICK);
    };
    __ui_HTMLTable.prototype.__class__.__init__ = function() {
        return __ui_HTMLTable.prototype.__init__.call.apply(__ui_HTMLTable.prototype.__init__, arguments);
    };
    __ui_HTMLTable.prototype.__class__.__init__.unbound_method = true;
    __ui_HTMLTable.prototype.__init__.instance_method = true;
    __ui_HTMLTable.prototype.addTableListener = function(listener) {
    this.tableListeners.append(listener);
    };
    __ui_HTMLTable.prototype.__class__.addTableListener = function() {
        return __ui_HTMLTable.prototype.addTableListener.call.apply(__ui_HTMLTable.prototype.addTableListener, arguments);
    };
    __ui_HTMLTable.prototype.__class__.addTableListener.unbound_method = true;
    __ui_HTMLTable.prototype.addTableListener.instance_method = true;
    __ui_HTMLTable.prototype.clear = function() {

        var __row = pyjslib_range(this.getRowCount()).__iter__();
        try {
            while (true) {
                var row = __row.next();
                
        

        var __col = pyjslib_range(this.getCellCount(row)).__iter__();
        try {
            while (true) {
                var col = __col.next();
                
        
    var child = this.getWidget(row, col);
    if ((child != null)) {
    this.removeWidget(child);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_HTMLTable.prototype.__class__.clear = function() {
        return __ui_HTMLTable.prototype.clear.call.apply(__ui_HTMLTable.prototype.clear, arguments);
    };
    __ui_HTMLTable.prototype.__class__.clear.unbound_method = true;
    __ui_HTMLTable.prototype.clear.instance_method = true;
    __ui_HTMLTable.prototype.clearCell = function(row, column) {
    var td = this.cellFormatter.getElement(row, column);
    return this.internalClearCell(td);
    };
    __ui_HTMLTable.prototype.__class__.clearCell = function() {
        return __ui_HTMLTable.prototype.clearCell.call.apply(__ui_HTMLTable.prototype.clearCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.clearCell.unbound_method = true;
    __ui_HTMLTable.prototype.clearCell.instance_method = true;
    __ui_HTMLTable.prototype.getCellCount = function(row) {
    return 0;
    };
    __ui_HTMLTable.prototype.__class__.getCellCount = function() {
        return __ui_HTMLTable.prototype.getCellCount.call.apply(__ui_HTMLTable.prototype.getCellCount, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getCellCount.unbound_method = true;
    __ui_HTMLTable.prototype.getCellCount.instance_method = true;
    __ui_HTMLTable.prototype.getCellFormatter = function() {
    return this.cellFormatter;
    };
    __ui_HTMLTable.prototype.__class__.getCellFormatter = function() {
        return __ui_HTMLTable.prototype.getCellFormatter.call.apply(__ui_HTMLTable.prototype.getCellFormatter, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getCellFormatter.unbound_method = true;
    __ui_HTMLTable.prototype.getCellFormatter.instance_method = true;
    __ui_HTMLTable.prototype.getCellPadding = function() {
    return DOM_getIntAttribute(this.tableElem, 'cellPadding');
    };
    __ui_HTMLTable.prototype.__class__.getCellPadding = function() {
        return __ui_HTMLTable.prototype.getCellPadding.call.apply(__ui_HTMLTable.prototype.getCellPadding, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getCellPadding.unbound_method = true;
    __ui_HTMLTable.prototype.getCellPadding.instance_method = true;
    __ui_HTMLTable.prototype.getCellSpacing = function() {
    return DOM_getIntAttribute(this.tableElem, 'cellSpacing');
    };
    __ui_HTMLTable.prototype.__class__.getCellSpacing = function() {
        return __ui_HTMLTable.prototype.getCellSpacing.call.apply(__ui_HTMLTable.prototype.getCellSpacing, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getCellSpacing.unbound_method = true;
    __ui_HTMLTable.prototype.getCellSpacing.instance_method = true;
    __ui_HTMLTable.prototype.getHTML = function(row, column) {
    var element = this.cellFormatter.getElement(row, column);
    return DOM_getInnerHTML(element);
    };
    __ui_HTMLTable.prototype.__class__.getHTML = function() {
        return __ui_HTMLTable.prototype.getHTML.call.apply(__ui_HTMLTable.prototype.getHTML, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getHTML.unbound_method = true;
    __ui_HTMLTable.prototype.getHTML.instance_method = true;
    __ui_HTMLTable.prototype.getRowCount = function() {
    return 0;
    };
    __ui_HTMLTable.prototype.__class__.getRowCount = function() {
        return __ui_HTMLTable.prototype.getRowCount.call.apply(__ui_HTMLTable.prototype.getRowCount, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getRowCount.unbound_method = true;
    __ui_HTMLTable.prototype.getRowCount.instance_method = true;
    __ui_HTMLTable.prototype.getRowFormatter = function() {
    return this.rowFormatter;
    };
    __ui_HTMLTable.prototype.__class__.getRowFormatter = function() {
        return __ui_HTMLTable.prototype.getRowFormatter.call.apply(__ui_HTMLTable.prototype.getRowFormatter, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getRowFormatter.unbound_method = true;
    __ui_HTMLTable.prototype.getRowFormatter.instance_method = true;
    __ui_HTMLTable.prototype.getText = function(row, column) {
    this.checkCellBounds(row, column);
    var element = this.cellFormatter.getElement(row, column);
    return DOM_getInnerText(element);
    };
    __ui_HTMLTable.prototype.__class__.getText = function() {
        return __ui_HTMLTable.prototype.getText.call.apply(__ui_HTMLTable.prototype.getText, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getText.unbound_method = true;
    __ui_HTMLTable.prototype.getText.instance_method = true;
    __ui_HTMLTable.prototype.getWidget = function(row, column) {
    if (typeof column == 'undefined') column=null;
    if ((column == null)) {
    var key = this.computeKeyForElement(row);
    }
    else {
    this.checkCellBounds(row, column);
    var key = this.computeKey(row, column);
    }
    if ((key == null)) {
    return;
    }
    return this.widgetMap.__getitem__(key);
    };
__ui_HTMLTable.prototype.getWidget.parse_kwargs = function ( __kwargs, row, column ) {
    if (typeof column == 'undefined')
        column=__kwargs.column;
    var __r = [row, column];
    return __r;
};
    __ui_HTMLTable.prototype.__class__.getWidget = function() {
        return __ui_HTMLTable.prototype.getWidget.call.apply(__ui_HTMLTable.prototype.getWidget, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getWidget.unbound_method = true;
    __ui_HTMLTable.prototype.getWidget.instance_method = true;
    __ui_HTMLTable.prototype.__class__.getWidget.parse_kwargs = __ui_HTMLTable.prototype.getWidget.parse_kwargs;
    __ui_HTMLTable.prototype.isCellPresent = function(row, column) {
    if (((row >= this.getRowCount())) || ((row < 0))) {
    return false;
    }
    if (((column < 0)) || ((column >= this.getCellCount(row)))) {
    return false;
    }
    return true;
    };
    __ui_HTMLTable.prototype.__class__.isCellPresent = function() {
        return __ui_HTMLTable.prototype.isCellPresent.call.apply(__ui_HTMLTable.prototype.isCellPresent, arguments);
    };
    __ui_HTMLTable.prototype.__class__.isCellPresent.unbound_method = true;
    __ui_HTMLTable.prototype.isCellPresent.instance_method = true;
    __ui_HTMLTable.prototype.__iter__ = function() {
    return this.widgetMap.itervalues();
    };
    __ui_HTMLTable.prototype.__class__.__iter__ = function() {
        return __ui_HTMLTable.prototype.__iter__.call.apply(__ui_HTMLTable.prototype.__iter__, arguments);
    };
    __ui_HTMLTable.prototype.__class__.__iter__.unbound_method = true;
    __ui_HTMLTable.prototype.__iter__.instance_method = true;
    __ui_HTMLTable.prototype.onBrowserEvent = function(event) {
    if ((DOM_eventGetType(event) == 'click')) {
    var td = this.getEventTargetCell(event);
    if (!(td)) {
    return;
    }
    var tr = DOM_getParent(td);
    var body = DOM_getParent(tr);
    var row = DOM_getChildIndex(body, tr);
    var column = DOM_getChildIndex(tr, td);

        var __listener = this.tableListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onCellClicked) {
    listener.onCellClicked(this, row, column);
    }
    else {
    listener(this);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_HTMLTable.prototype.__class__.onBrowserEvent = function() {
        return __ui_HTMLTable.prototype.onBrowserEvent.call.apply(__ui_HTMLTable.prototype.onBrowserEvent, arguments);
    };
    __ui_HTMLTable.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_HTMLTable.prototype.onBrowserEvent.instance_method = true;
    __ui_HTMLTable.prototype.remove = function(widget) {
    if ((widget.getParent() != this)) {
    return false;
    }
    this.removeWidget(widget);
    return true;
    };
    __ui_HTMLTable.prototype.__class__.remove = function() {
        return __ui_HTMLTable.prototype.remove.call.apply(__ui_HTMLTable.prototype.remove, arguments);
    };
    __ui_HTMLTable.prototype.__class__.remove.unbound_method = true;
    __ui_HTMLTable.prototype.remove.instance_method = true;
    __ui_HTMLTable.prototype.removeTableListener = function(listener) {
    this.tableListeners.remove(listener);
    };
    __ui_HTMLTable.prototype.__class__.removeTableListener = function() {
        return __ui_HTMLTable.prototype.removeTableListener.call.apply(__ui_HTMLTable.prototype.removeTableListener, arguments);
    };
    __ui_HTMLTable.prototype.__class__.removeTableListener.unbound_method = true;
    __ui_HTMLTable.prototype.removeTableListener.instance_method = true;
    __ui_HTMLTable.prototype.setBorderWidth = function(width) {
    DOM_setAttribute(this.tableElem, 'border', width);
    };
    __ui_HTMLTable.prototype.__class__.setBorderWidth = function() {
        return __ui_HTMLTable.prototype.setBorderWidth.call.apply(__ui_HTMLTable.prototype.setBorderWidth, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setBorderWidth.unbound_method = true;
    __ui_HTMLTable.prototype.setBorderWidth.instance_method = true;
    __ui_HTMLTable.prototype.setCellPadding = function(padding) {
    DOM_setIntAttribute(this.tableElem, 'cellPadding', padding);
    };
    __ui_HTMLTable.prototype.__class__.setCellPadding = function() {
        return __ui_HTMLTable.prototype.setCellPadding.call.apply(__ui_HTMLTable.prototype.setCellPadding, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setCellPadding.unbound_method = true;
    __ui_HTMLTable.prototype.setCellPadding.instance_method = true;
    __ui_HTMLTable.prototype.setCellSpacing = function(spacing) {
    DOM_setIntAttribute(this.tableElem, 'cellSpacing', spacing);
    };
    __ui_HTMLTable.prototype.__class__.setCellSpacing = function() {
        return __ui_HTMLTable.prototype.setCellSpacing.call.apply(__ui_HTMLTable.prototype.setCellSpacing, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setCellSpacing.unbound_method = true;
    __ui_HTMLTable.prototype.setCellSpacing.instance_method = true;
    __ui_HTMLTable.prototype.setHTML = function(row, column, html) {
    this.prepareCell(row, column);
    var td = this.cleanCell(row, column);
    if ((html != null)) {
    DOM_setInnerHTML(td, html);
    }
    };
    __ui_HTMLTable.prototype.__class__.setHTML = function() {
        return __ui_HTMLTable.prototype.setHTML.call.apply(__ui_HTMLTable.prototype.setHTML, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setHTML.unbound_method = true;
    __ui_HTMLTable.prototype.setHTML.instance_method = true;
    __ui_HTMLTable.prototype.setText = function(row, column, text) {
    this.prepareCell(row, column);
    var td = this.cleanCell(row, column);
    if ((text != null)) {
    DOM_setInnerText(td, text);
    }
    };
    __ui_HTMLTable.prototype.__class__.setText = function() {
        return __ui_HTMLTable.prototype.setText.call.apply(__ui_HTMLTable.prototype.setText, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setText.unbound_method = true;
    __ui_HTMLTable.prototype.setText.instance_method = true;
    __ui_HTMLTable.prototype.setWidget = function(row, column, widget) {
    this.prepareCell(row, column);
    if ((widget == null)) {
    return;
    }
    widget.removeFromParent();
    var td = this.cleanCell(row, column);
    var widget_hash = pyjslib_hash(widget);
    var element = widget.getElement();
    DOM_setAttribute(element, '__hash', widget_hash);
    this.widgetMap.__setitem__(widget_hash, widget);
    this.adopt(widget, td);
    };
    __ui_HTMLTable.prototype.__class__.setWidget = function() {
        return __ui_HTMLTable.prototype.setWidget.call.apply(__ui_HTMLTable.prototype.setWidget, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setWidget.unbound_method = true;
    __ui_HTMLTable.prototype.setWidget.instance_method = true;
    __ui_HTMLTable.prototype.cleanCell = function(row, column) {
    var td = this.cellFormatter.getRawElement(row, column);
    this.internalClearCell(td);
    return td;
    };
    __ui_HTMLTable.prototype.__class__.cleanCell = function() {
        return __ui_HTMLTable.prototype.cleanCell.call.apply(__ui_HTMLTable.prototype.cleanCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.cleanCell.unbound_method = true;
    __ui_HTMLTable.prototype.cleanCell.instance_method = true;
    __ui_HTMLTable.prototype.computeKey = function(row, column) {
    var element = this.cellFormatter.getRawElement(row, column);
    var child = DOM_getFirstChild(element);
    if ((child == null)) {
    return;
    }
    return this.computeKeyForElement(child);
    };
    __ui_HTMLTable.prototype.__class__.computeKey = function() {
        return __ui_HTMLTable.prototype.computeKey.call.apply(__ui_HTMLTable.prototype.computeKey, arguments);
    };
    __ui_HTMLTable.prototype.__class__.computeKey.unbound_method = true;
    __ui_HTMLTable.prototype.computeKey.instance_method = true;
    __ui_HTMLTable.prototype.computeKeyForElement = function(widgetElement) {
    return DOM_getAttribute(widgetElement, '__hash');
    };
    __ui_HTMLTable.prototype.__class__.computeKeyForElement = function() {
        return __ui_HTMLTable.prototype.computeKeyForElement.call.apply(__ui_HTMLTable.prototype.computeKeyForElement, arguments);
    };
    __ui_HTMLTable.prototype.__class__.computeKeyForElement.unbound_method = true;
    __ui_HTMLTable.prototype.computeKeyForElement.instance_method = true;
    __ui_HTMLTable.prototype.removeWidget = function(widget) {
    this.disown(widget);
    this.widgetMap.__delitem__(this.computeKeyForElement(widget.getElement()));
    return true;
    };
    __ui_HTMLTable.prototype.__class__.removeWidget = function() {
        return __ui_HTMLTable.prototype.removeWidget.call.apply(__ui_HTMLTable.prototype.removeWidget, arguments);
    };
    __ui_HTMLTable.prototype.__class__.removeWidget.unbound_method = true;
    __ui_HTMLTable.prototype.removeWidget.instance_method = true;
    __ui_HTMLTable.prototype.checkCellBounds = function(row, column) {
    this.checkRowBounds(row);
    var cellSize = this.getCellCount(row);
    };
    __ui_HTMLTable.prototype.__class__.checkCellBounds = function() {
        return __ui_HTMLTable.prototype.checkCellBounds.call.apply(__ui_HTMLTable.prototype.checkCellBounds, arguments);
    };
    __ui_HTMLTable.prototype.__class__.checkCellBounds.unbound_method = true;
    __ui_HTMLTable.prototype.checkCellBounds.instance_method = true;
    __ui_HTMLTable.prototype.checkRowBounds = function(row) {
    var rowSize = this.getRowCount();
    };
    __ui_HTMLTable.prototype.__class__.checkRowBounds = function() {
        return __ui_HTMLTable.prototype.checkRowBounds.call.apply(__ui_HTMLTable.prototype.checkRowBounds, arguments);
    };
    __ui_HTMLTable.prototype.__class__.checkRowBounds.unbound_method = true;
    __ui_HTMLTable.prototype.checkRowBounds.instance_method = true;
    __ui_HTMLTable.prototype.createCell = function() {
    return DOM_createTD();
    };
    __ui_HTMLTable.prototype.__class__.createCell = function() {
        return __ui_HTMLTable.prototype.createCell.call.apply(__ui_HTMLTable.prototype.createCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.createCell.unbound_method = true;
    __ui_HTMLTable.prototype.createCell.instance_method = true;
    __ui_HTMLTable.prototype.getBodyElement = function() {
    return this.bodyElem;
    };
    __ui_HTMLTable.prototype.__class__.getBodyElement = function() {
        return __ui_HTMLTable.prototype.getBodyElement.call.apply(__ui_HTMLTable.prototype.getBodyElement, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getBodyElement.unbound_method = true;
    __ui_HTMLTable.prototype.getBodyElement.instance_method = true;
    __ui_HTMLTable.prototype.getDOMCellCount = function(element, row) {
    if (typeof row == 'undefined') row=null;
    if ((row == null)) {
    return this.getDOMCellCountImpl(this.bodyElem, element);
    }
    return this.getDOMCellCountImpl(element, row);
    };
__ui_HTMLTable.prototype.getDOMCellCount.parse_kwargs = function ( __kwargs, element, row ) {
    if (typeof row == 'undefined')
        row=__kwargs.row;
    var __r = [element, row];
    return __r;
};
    __ui_HTMLTable.prototype.__class__.getDOMCellCount = function() {
        return __ui_HTMLTable.prototype.getDOMCellCount.call.apply(__ui_HTMLTable.prototype.getDOMCellCount, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getDOMCellCount.unbound_method = true;
    __ui_HTMLTable.prototype.getDOMCellCount.instance_method = true;
    __ui_HTMLTable.prototype.__class__.getDOMCellCount.parse_kwargs = __ui_HTMLTable.prototype.getDOMCellCount.parse_kwargs;
    __ui_HTMLTable.prototype.getDOMCellCountImpl = function(element, row) {

        return element.rows[row].cells.length;
        
    };
    __ui_HTMLTable.prototype.__class__.getDOMCellCountImpl = function() {
        return __ui_HTMLTable.prototype.getDOMCellCountImpl.call.apply(__ui_HTMLTable.prototype.getDOMCellCountImpl, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getDOMCellCountImpl.unbound_method = true;
    __ui_HTMLTable.prototype.getDOMCellCountImpl.instance_method = true;
    __ui_HTMLTable.prototype.getDOMRowCount = function(element) {
    if (typeof element == 'undefined') element=null;
    if ((element == null)) {
    var element = this.bodyElem;
    }
    return this.getDOMRowCountImpl(element);
    };
__ui_HTMLTable.prototype.getDOMRowCount.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
    __ui_HTMLTable.prototype.__class__.getDOMRowCount = function() {
        return __ui_HTMLTable.prototype.getDOMRowCount.call.apply(__ui_HTMLTable.prototype.getDOMRowCount, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getDOMRowCount.unbound_method = true;
    __ui_HTMLTable.prototype.getDOMRowCount.instance_method = true;
    __ui_HTMLTable.prototype.__class__.getDOMRowCount.parse_kwargs = __ui_HTMLTable.prototype.getDOMRowCount.parse_kwargs;
    __ui_HTMLTable.prototype.getDOMRowCountImpl = function(element) {

        return element.rows.length;
        
    };
    __ui_HTMLTable.prototype.__class__.getDOMRowCountImpl = function() {
        return __ui_HTMLTable.prototype.getDOMRowCountImpl.call.apply(__ui_HTMLTable.prototype.getDOMRowCountImpl, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getDOMRowCountImpl.unbound_method = true;
    __ui_HTMLTable.prototype.getDOMRowCountImpl.instance_method = true;
    __ui_HTMLTable.prototype.getEventTargetCell = function(event) {
    var td = DOM_eventGetTarget(event);
    while ((td != null)) {
    if ((DOM_getAttribute(td, 'tagName').lower() == 'td')) {
    var tr = DOM_getParent(td);
    var body = DOM_getParent(tr);
    if (DOM_compare(body, this.bodyElem)) {
    return td;
    }
    }
    if (DOM_compare(td, this.bodyElem)) {
    return;
    }
    var td = DOM_getParent(td);
    }
    return;
    };
    __ui_HTMLTable.prototype.__class__.getEventTargetCell = function() {
        return __ui_HTMLTable.prototype.getEventTargetCell.call.apply(__ui_HTMLTable.prototype.getEventTargetCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.getEventTargetCell.unbound_method = true;
    __ui_HTMLTable.prototype.getEventTargetCell.instance_method = true;
    __ui_HTMLTable.prototype.insertCell = function(row, column) {
    var tr = this.rowFormatter.getRow(this.bodyElem, row);
    var td = this.createCell();
    DOM_insertChild(tr, td, column);
    };
    __ui_HTMLTable.prototype.__class__.insertCell = function() {
        return __ui_HTMLTable.prototype.insertCell.call.apply(__ui_HTMLTable.prototype.insertCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.insertCell.unbound_method = true;
    __ui_HTMLTable.prototype.insertCell.instance_method = true;
    __ui_HTMLTable.prototype.insertCells = function(row, column, count) {
    var tr = this.rowFormatter.getRow(this.bodyElem, row);

        var __i = pyjslib_range(column,  ( column + count ) ).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var td = this.createCell();
    DOM_insertChild(tr, td, i);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_HTMLTable.prototype.__class__.insertCells = function() {
        return __ui_HTMLTable.prototype.insertCells.call.apply(__ui_HTMLTable.prototype.insertCells, arguments);
    };
    __ui_HTMLTable.prototype.__class__.insertCells.unbound_method = true;
    __ui_HTMLTable.prototype.insertCells.instance_method = true;
    __ui_HTMLTable.prototype.insertRow = function(beforeRow) {
    if ((beforeRow != this.getRowCount())) {
    this.checkRowBounds(beforeRow);
    }
    var tr = DOM_createTR();
    DOM_insertChild(this.bodyElem, tr, beforeRow);
    return beforeRow;
    };
    __ui_HTMLTable.prototype.__class__.insertRow = function() {
        return __ui_HTMLTable.prototype.insertRow.call.apply(__ui_HTMLTable.prototype.insertRow, arguments);
    };
    __ui_HTMLTable.prototype.__class__.insertRow.unbound_method = true;
    __ui_HTMLTable.prototype.insertRow.instance_method = true;
    __ui_HTMLTable.prototype.internalClearCell = function(td) {
    var maybeChild = DOM_getFirstChild(td);
    var widget = null;
    if ((maybeChild != null)) {
    var widget = this.getWidget(maybeChild);
    }
    if ((widget != null)) {
    this.removeWidget(widget);
    return true;
    }
    DOM_setInnerHTML(td, '');
    return false;
    };
    __ui_HTMLTable.prototype.__class__.internalClearCell = function() {
        return __ui_HTMLTable.prototype.internalClearCell.call.apply(__ui_HTMLTable.prototype.internalClearCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.internalClearCell.unbound_method = true;
    __ui_HTMLTable.prototype.internalClearCell.instance_method = true;
    __ui_HTMLTable.prototype.prepareCell = function(row, column) {
    };
    __ui_HTMLTable.prototype.__class__.prepareCell = function() {
        return __ui_HTMLTable.prototype.prepareCell.call.apply(__ui_HTMLTable.prototype.prepareCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.prepareCell.unbound_method = true;
    __ui_HTMLTable.prototype.prepareCell.instance_method = true;
    __ui_HTMLTable.prototype.prepareRow = function(row) {
    };
    __ui_HTMLTable.prototype.__class__.prepareRow = function() {
        return __ui_HTMLTable.prototype.prepareRow.call.apply(__ui_HTMLTable.prototype.prepareRow, arguments);
    };
    __ui_HTMLTable.prototype.__class__.prepareRow.unbound_method = true;
    __ui_HTMLTable.prototype.prepareRow.instance_method = true;
    __ui_HTMLTable.prototype.removeCell = function(row, column) {
    this.checkCellBounds(row, column);
    var td = this.cleanCell(row, column);
    var tr = this.rowFormatter.getRow(this.bodyElem, row);
    DOM_removeChild(tr, td);
    };
    __ui_HTMLTable.prototype.__class__.removeCell = function() {
        return __ui_HTMLTable.prototype.removeCell.call.apply(__ui_HTMLTable.prototype.removeCell, arguments);
    };
    __ui_HTMLTable.prototype.__class__.removeCell.unbound_method = true;
    __ui_HTMLTable.prototype.removeCell.instance_method = true;
    __ui_HTMLTable.prototype.removeRow = function(row) {

        var __column = pyjslib_range(this.getCellCount(row)).__iter__();
        try {
            while (true) {
                var column = __column.next();
                
        
    this.cleanCell(row, column);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    DOM_removeChild(this.bodyElem, this.rowFormatter.getRow(this.bodyElem, row));
    };
    __ui_HTMLTable.prototype.__class__.removeRow = function() {
        return __ui_HTMLTable.prototype.removeRow.call.apply(__ui_HTMLTable.prototype.removeRow, arguments);
    };
    __ui_HTMLTable.prototype.__class__.removeRow.unbound_method = true;
    __ui_HTMLTable.prototype.removeRow.instance_method = true;
    __ui_HTMLTable.prototype.setCellFormatter = function(cellFormatter) {
    this.cellFormatter = cellFormatter;
    };
    __ui_HTMLTable.prototype.__class__.setCellFormatter = function() {
        return __ui_HTMLTable.prototype.setCellFormatter.call.apply(__ui_HTMLTable.prototype.setCellFormatter, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setCellFormatter.unbound_method = true;
    __ui_HTMLTable.prototype.setCellFormatter.instance_method = true;
    __ui_HTMLTable.prototype.setRowFormatter = function(rowFormatter) {
    this.rowFormatter = rowFormatter;
    };
    __ui_HTMLTable.prototype.__class__.setRowFormatter = function() {
        return __ui_HTMLTable.prototype.setRowFormatter.call.apply(__ui_HTMLTable.prototype.setRowFormatter, arguments);
    };
    __ui_HTMLTable.prototype.__class__.setRowFormatter.unbound_method = true;
    __ui_HTMLTable.prototype.setRowFormatter.instance_method = true;
}
function __ui_Grid() {
}
function ui_Grid(rows, columns) {
    if (typeof rows == 'undefined') rows=0;
    if (typeof columns == 'undefined') columns=0;
    var instance = new __ui_Grid();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Grid.parse_kwargs = function ( __kwargs, rows, columns ) {
    if (typeof rows == 'undefined')
        rows=__kwargs.rows;
    if (typeof columns == 'undefined')
        columns=__kwargs.columns;
    var __r = [rows, columns];
    return __r;
};
function __ui_Grid_initialize() {
    if(__ui_Grid.__was_initialized__) return;
    __ui_Grid.__was_initialized__ = true;
    if(!__ui_HTMLTable.__was_initialized__)
        __ui_HTMLTable_initialize();
    pyjs_extend(__ui_Grid, __ui_HTMLTable);
    __ui_Grid.prototype.__class__.__new__ = ui_Grid;
    __ui_Grid.prototype.__init__ = function(rows, columns) {
    if (typeof rows == 'undefined') rows=0;
    if (typeof columns == 'undefined') columns=0;
    __ui_HTMLTable.prototype.__class__.__init__(this);
    this.cellFormatter = ui_CellFormatter(this);
    this.rowFormatter = ui_RowFormatter(this);
    this.numColumns = 0;
    this.numRows = 0;
    if (((rows > 0)) || ((columns > 0))) {
    this.resize(rows, columns);
    }
    };
__ui_Grid.prototype.__init__.parse_kwargs = function ( __kwargs, rows, columns ) {
    if (typeof rows == 'undefined')
        rows=__kwargs.rows;
    if (typeof columns == 'undefined')
        columns=__kwargs.columns;
    var __r = [rows, columns];
    return __r;
};
    __ui_Grid.prototype.__class__.__init__ = function() {
        return __ui_Grid.prototype.__init__.call.apply(__ui_Grid.prototype.__init__, arguments);
    };
    __ui_Grid.prototype.__class__.__init__.unbound_method = true;
    __ui_Grid.prototype.__init__.instance_method = true;
    __ui_Grid.prototype.__class__.__init__.parse_kwargs = __ui_Grid.prototype.__init__.parse_kwargs;
    __ui_Grid.prototype.resize = function(rows, columns) {
    this.resizeColumns(columns);
    this.resizeRows(rows);
    };
    __ui_Grid.prototype.__class__.resize = function() {
        return __ui_Grid.prototype.resize.call.apply(__ui_Grid.prototype.resize, arguments);
    };
    __ui_Grid.prototype.__class__.resize.unbound_method = true;
    __ui_Grid.prototype.resize.instance_method = true;
    __ui_Grid.prototype.resizeColumns = function(columns) {
    if ((this.numColumns == columns)) {
    return;
    }
    if ((this.numColumns > columns)) {

        var __i = pyjslib_range(0, this.numRows).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        

        var __j = pyjslib_range( ( this.numColumns - 1 ) ,  ( columns - 1 ) , -1).__iter__();
        try {
            while (true) {
                var j = __j.next();
                
        
    this.removeCell(i, j);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else {

        var __i = pyjslib_range(this.numRows).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        

        var __j = pyjslib_range(this.numColumns, columns).__iter__();
        try {
            while (true) {
                var j = __j.next();
                
        
    this.insertCell(i, j);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    this.numColumns = columns;
    };
    __ui_Grid.prototype.__class__.resizeColumns = function() {
        return __ui_Grid.prototype.resizeColumns.call.apply(__ui_Grid.prototype.resizeColumns, arguments);
    };
    __ui_Grid.prototype.__class__.resizeColumns.unbound_method = true;
    __ui_Grid.prototype.resizeColumns.instance_method = true;
    __ui_Grid.prototype.resizeRows = function(rows) {
    if ((this.numRows == rows)) {
    return;
    }
    if ((this.numRows < rows)) {
    this.addRows(this.getBodyElement(),  ( rows - this.numRows ) , this.numColumns);
    this.numRows = rows;
    }
    else {
    while ((this.numRows > rows)) {
    this.numRows -= 1;
    this.removeRow(this.numRows);
    }
    }
    };
    __ui_Grid.prototype.__class__.resizeRows = function() {
        return __ui_Grid.prototype.resizeRows.call.apply(__ui_Grid.prototype.resizeRows, arguments);
    };
    __ui_Grid.prototype.__class__.resizeRows.unbound_method = true;
    __ui_Grid.prototype.resizeRows.instance_method = true;
    __ui_Grid.prototype.createCell = function() {
    var td = __ui_HTMLTable.prototype.__class__.createCell(this);
    DOM_setInnerHTML(td, '&nbsp;');
    return td;
    };
    __ui_Grid.prototype.__class__.createCell = function() {
        return __ui_Grid.prototype.createCell.call.apply(__ui_Grid.prototype.createCell, arguments);
    };
    __ui_Grid.prototype.__class__.createCell.unbound_method = true;
    __ui_Grid.prototype.createCell.instance_method = true;
    __ui_Grid.prototype.clearCell = function(row, column) {
    var td = this.cellFormatter.getElement(row, column);
    var b = __ui_HTMLTable.prototype.__class__.internalClearCell(this, td);
    DOM_setInnerHTML(td, '&nbsp;');
    return b;
    };
    __ui_Grid.prototype.__class__.clearCell = function() {
        return __ui_Grid.prototype.clearCell.call.apply(__ui_Grid.prototype.clearCell, arguments);
    };
    __ui_Grid.prototype.__class__.clearCell.unbound_method = true;
    __ui_Grid.prototype.clearCell.instance_method = true;
    __ui_Grid.prototype.prepareCell = function(row, column) {
    };
    __ui_Grid.prototype.__class__.prepareCell = function() {
        return __ui_Grid.prototype.prepareCell.call.apply(__ui_Grid.prototype.prepareCell, arguments);
    };
    __ui_Grid.prototype.__class__.prepareCell.unbound_method = true;
    __ui_Grid.prototype.prepareCell.instance_method = true;
    __ui_Grid.prototype.prepareRow = function(row) {
    };
    __ui_Grid.prototype.__class__.prepareRow = function() {
        return __ui_Grid.prototype.prepareRow.call.apply(__ui_Grid.prototype.prepareRow, arguments);
    };
    __ui_Grid.prototype.__class__.prepareRow.unbound_method = true;
    __ui_Grid.prototype.prepareRow.instance_method = true;
    __ui_Grid.prototype.getCellCount = function(row) {
    return this.numColumns;
    };
    __ui_Grid.prototype.__class__.getCellCount = function() {
        return __ui_Grid.prototype.getCellCount.call.apply(__ui_Grid.prototype.getCellCount, arguments);
    };
    __ui_Grid.prototype.__class__.getCellCount.unbound_method = true;
    __ui_Grid.prototype.getCellCount.instance_method = true;
    __ui_Grid.prototype.getColumnCount = function() {
    return this.numColumns;
    };
    __ui_Grid.prototype.__class__.getColumnCount = function() {
        return __ui_Grid.prototype.getColumnCount.call.apply(__ui_Grid.prototype.getColumnCount, arguments);
    };
    __ui_Grid.prototype.__class__.getColumnCount.unbound_method = true;
    __ui_Grid.prototype.getColumnCount.instance_method = true;
    __ui_Grid.prototype.getRowCount = function() {
    return this.numRows;
    };
    __ui_Grid.prototype.__class__.getRowCount = function() {
        return __ui_Grid.prototype.getRowCount.call.apply(__ui_Grid.prototype.getRowCount, arguments);
    };
    __ui_Grid.prototype.__class__.getRowCount.unbound_method = true;
    __ui_Grid.prototype.getRowCount.instance_method = true;
    __ui_Grid.prototype.addRows = function(table, numRows, columns) {

        var td = $doc.createElement("td");
        td.innerHTML = "&nbsp;";
        var row = $doc.createElement("tr");
        for(var cellNum = 0; cellNum < columns; cellNum++) {
            var cell = td.cloneNode(true);
            row.appendChild(cell);
        }
        table.appendChild(row);
        for(var rowNum = 1; rowNum < numRows; rowNum++) {
            table.appendChild(row.cloneNode(true));
        }
        
    };
    __ui_Grid.prototype.__class__.addRows = function() {
        return __ui_Grid.prototype.addRows.call.apply(__ui_Grid.prototype.addRows, arguments);
    };
    __ui_Grid.prototype.__class__.addRows.unbound_method = true;
    __ui_Grid.prototype.addRows.instance_method = true;
}
function __ui_FlexCellFormatter() {
}
function ui_FlexCellFormatter(outer) {
    var instance = new __ui_FlexCellFormatter();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FlexCellFormatter_initialize() {
    if(__ui_FlexCellFormatter.__was_initialized__) return;
    __ui_FlexCellFormatter.__was_initialized__ = true;
    if(!__ui_CellFormatter.__was_initialized__)
        __ui_CellFormatter_initialize();
    pyjs_extend(__ui_FlexCellFormatter, __ui_CellFormatter);
    __ui_FlexCellFormatter.prototype.__class__.__new__ = ui_FlexCellFormatter;
    __ui_FlexCellFormatter.prototype.__init__ = function(outer) {
    __ui_CellFormatter.prototype.__class__.__init__(this, outer);
    };
    __ui_FlexCellFormatter.prototype.__class__.__init__ = function() {
        return __ui_FlexCellFormatter.prototype.__init__.call.apply(__ui_FlexCellFormatter.prototype.__init__, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.__init__.unbound_method = true;
    __ui_FlexCellFormatter.prototype.__init__.instance_method = true;
    __ui_FlexCellFormatter.prototype.getColSpan = function(row, column) {
    return DOM_getIntAttribute(this.getElement(row, column), 'colSpan');
    };
    __ui_FlexCellFormatter.prototype.__class__.getColSpan = function() {
        return __ui_FlexCellFormatter.prototype.getColSpan.call.apply(__ui_FlexCellFormatter.prototype.getColSpan, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.getColSpan.unbound_method = true;
    __ui_FlexCellFormatter.prototype.getColSpan.instance_method = true;
    __ui_FlexCellFormatter.prototype.getRowSpan = function(row, column) {
    return DOM_getIntAttribute(this.getElement(row, column), 'rowSpan');
    };
    __ui_FlexCellFormatter.prototype.__class__.getRowSpan = function() {
        return __ui_FlexCellFormatter.prototype.getRowSpan.call.apply(__ui_FlexCellFormatter.prototype.getRowSpan, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.getRowSpan.unbound_method = true;
    __ui_FlexCellFormatter.prototype.getRowSpan.instance_method = true;
    __ui_FlexCellFormatter.prototype.setColSpan = function(row, column, colSpan) {
    DOM_setIntAttribute(this.ensureElement(row, column), 'colSpan', colSpan);
    };
    __ui_FlexCellFormatter.prototype.__class__.setColSpan = function() {
        return __ui_FlexCellFormatter.prototype.setColSpan.call.apply(__ui_FlexCellFormatter.prototype.setColSpan, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.setColSpan.unbound_method = true;
    __ui_FlexCellFormatter.prototype.setColSpan.instance_method = true;
    __ui_FlexCellFormatter.prototype.setRowSpan = function(row, column, rowSpan) {
    DOM_setIntAttribute(this.ensureElement(row, column), 'rowSpan', rowSpan);
    };
    __ui_FlexCellFormatter.prototype.__class__.setRowSpan = function() {
        return __ui_FlexCellFormatter.prototype.setRowSpan.call.apply(__ui_FlexCellFormatter.prototype.setRowSpan, arguments);
    };
    __ui_FlexCellFormatter.prototype.__class__.setRowSpan.unbound_method = true;
    __ui_FlexCellFormatter.prototype.setRowSpan.instance_method = true;
}
function __ui_FlexTable() {
}
function ui_FlexTable() {
    var instance = new __ui_FlexTable();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FlexTable_initialize() {
    if(__ui_FlexTable.__was_initialized__) return;
    __ui_FlexTable.__was_initialized__ = true;
    if(!__ui_HTMLTable.__was_initialized__)
        __ui_HTMLTable_initialize();
    pyjs_extend(__ui_FlexTable, __ui_HTMLTable);
    __ui_FlexTable.prototype.__class__.__new__ = ui_FlexTable;
    __ui_FlexTable.prototype.__init__ = function() {
    __ui_HTMLTable.prototype.__class__.__init__(this);
    this.cellFormatter = ui_FlexCellFormatter(this);
    this.rowFormatter = ui_RowFormatter(this);
    };
    __ui_FlexTable.prototype.__class__.__init__ = function() {
        return __ui_FlexTable.prototype.__init__.call.apply(__ui_FlexTable.prototype.__init__, arguments);
    };
    __ui_FlexTable.prototype.__class__.__init__.unbound_method = true;
    __ui_FlexTable.prototype.__init__.instance_method = true;
    __ui_FlexTable.prototype.addCell = function(row) {
    this.insertCell(row, this.getCellCount(row));
    };
    __ui_FlexTable.prototype.__class__.addCell = function() {
        return __ui_FlexTable.prototype.addCell.call.apply(__ui_FlexTable.prototype.addCell, arguments);
    };
    __ui_FlexTable.prototype.__class__.addCell.unbound_method = true;
    __ui_FlexTable.prototype.addCell.instance_method = true;
    __ui_FlexTable.prototype.getCellCount = function(row) {
    this.checkRowBounds(row);
    return this.getDOMCellCount(this.getBodyElement(), row);
    };
    __ui_FlexTable.prototype.__class__.getCellCount = function() {
        return __ui_FlexTable.prototype.getCellCount.call.apply(__ui_FlexTable.prototype.getCellCount, arguments);
    };
    __ui_FlexTable.prototype.__class__.getCellCount.unbound_method = true;
    __ui_FlexTable.prototype.getCellCount.instance_method = true;
    __ui_FlexTable.prototype.getFlexCellFormatter = function() {
    return this.getCellFormatter();
    };
    __ui_FlexTable.prototype.__class__.getFlexCellFormatter = function() {
        return __ui_FlexTable.prototype.getFlexCellFormatter.call.apply(__ui_FlexTable.prototype.getFlexCellFormatter, arguments);
    };
    __ui_FlexTable.prototype.__class__.getFlexCellFormatter.unbound_method = true;
    __ui_FlexTable.prototype.getFlexCellFormatter.instance_method = true;
    __ui_FlexTable.prototype.getRowCount = function() {
    return this.getDOMRowCount();
    };
    __ui_FlexTable.prototype.__class__.getRowCount = function() {
        return __ui_FlexTable.prototype.getRowCount.call.apply(__ui_FlexTable.prototype.getRowCount, arguments);
    };
    __ui_FlexTable.prototype.__class__.getRowCount.unbound_method = true;
    __ui_FlexTable.prototype.getRowCount.instance_method = true;
    __ui_FlexTable.prototype.removeCells = function(row, column, num) {

        var __i = pyjslib_range(num).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.removeCell(row, column);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_FlexTable.prototype.__class__.removeCells = function() {
        return __ui_FlexTable.prototype.removeCells.call.apply(__ui_FlexTable.prototype.removeCells, arguments);
    };
    __ui_FlexTable.prototype.__class__.removeCells.unbound_method = true;
    __ui_FlexTable.prototype.removeCells.instance_method = true;
    __ui_FlexTable.prototype.prepareCell = function(row, column) {
    this.prepareRow(row);
    var cellCount = this.getCellCount(row);
    var required =  (  ( column + 1 )  - cellCount ) ;
    if ((required > 0)) {
    this.addCells(this.getBodyElement(), row, required);
    }
    };
    __ui_FlexTable.prototype.__class__.prepareCell = function() {
        return __ui_FlexTable.prototype.prepareCell.call.apply(__ui_FlexTable.prototype.prepareCell, arguments);
    };
    __ui_FlexTable.prototype.__class__.prepareCell.unbound_method = true;
    __ui_FlexTable.prototype.prepareCell.instance_method = true;
    __ui_FlexTable.prototype.prepareRow = function(row) {
    var rowCount = this.getRowCount();

        var __i = pyjslib_range(rowCount,  ( row + 1 ) ).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.insertRow(i);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_FlexTable.prototype.__class__.prepareRow = function() {
        return __ui_FlexTable.prototype.prepareRow.call.apply(__ui_FlexTable.prototype.prepareRow, arguments);
    };
    __ui_FlexTable.prototype.__class__.prepareRow.unbound_method = true;
    __ui_FlexTable.prototype.prepareRow.instance_method = true;
    __ui_FlexTable.prototype.addCells = function(table, row, num) {

        var rowElem = table.rows[row];
        for(var i = 0; i < num; i++){
            var cell = $doc.createElement("td");
            rowElem.appendChild(cell);
        }
        
    };
    __ui_FlexTable.prototype.__class__.addCells = function() {
        return __ui_FlexTable.prototype.addCells.call.apply(__ui_FlexTable.prototype.addCells, arguments);
    };
    __ui_FlexTable.prototype.__class__.addCells.unbound_method = true;
    __ui_FlexTable.prototype.addCells.instance_method = true;
}
function __ui_ComplexPanel() {
}
function ui_ComplexPanel() {
    var instance = new __ui_ComplexPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ComplexPanel_initialize() {
    if(__ui_ComplexPanel.__was_initialized__) return;
    __ui_ComplexPanel.__was_initialized__ = true;
    if(!__ui_Panel.__was_initialized__)
        __ui_Panel_initialize();
    pyjs_extend(__ui_ComplexPanel, __ui_Panel);
    __ui_ComplexPanel.prototype.__class__.__new__ = ui_ComplexPanel;
    __ui_ComplexPanel.prototype.__init__ = function() {
    __ui_Panel.prototype.__class__.__init__(this);
    this.children = new pyjslib_List([]);
    };
    __ui_ComplexPanel.prototype.__class__.__init__ = function() {
        return __ui_ComplexPanel.prototype.__init__.call.apply(__ui_ComplexPanel.prototype.__init__, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_ComplexPanel.prototype.__init__.instance_method = true;
    __ui_ComplexPanel.prototype.add = function(widget, container) {
    this.insert(widget, container, pyjslib_len(this.children));
    };
    __ui_ComplexPanel.prototype.__class__.add = function() {
        return __ui_ComplexPanel.prototype.add.call.apply(__ui_ComplexPanel.prototype.add, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.add.unbound_method = true;
    __ui_ComplexPanel.prototype.add.instance_method = true;
    __ui_ComplexPanel.prototype.getChildren = function() {
    return this.children;
    };
    __ui_ComplexPanel.prototype.__class__.getChildren = function() {
        return __ui_ComplexPanel.prototype.getChildren.call.apply(__ui_ComplexPanel.prototype.getChildren, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.getChildren.unbound_method = true;
    __ui_ComplexPanel.prototype.getChildren.instance_method = true;
    __ui_ComplexPanel.prototype.insert = function(widget, container, beforeIndex) {
    if ((widget.getParent() == this)) {
    return;
    }
    this.adopt(widget, container);
    this.children.insert(beforeIndex, widget);
    };
    __ui_ComplexPanel.prototype.__class__.insert = function() {
        return __ui_ComplexPanel.prototype.insert.call.apply(__ui_ComplexPanel.prototype.insert, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.insert.unbound_method = true;
    __ui_ComplexPanel.prototype.insert.instance_method = true;
    __ui_ComplexPanel.prototype.remove = function(widget) {
    if (!this.children.__contains__(widget)) {
    return false;
    }
    this.disown(widget);
    this.children.remove(widget);
    return true;
    };
    __ui_ComplexPanel.prototype.__class__.remove = function() {
        return __ui_ComplexPanel.prototype.remove.call.apply(__ui_ComplexPanel.prototype.remove, arguments);
    };
    __ui_ComplexPanel.prototype.__class__.remove.unbound_method = true;
    __ui_ComplexPanel.prototype.remove.instance_method = true;
}
function __ui_AbsolutePanel() {
}
function ui_AbsolutePanel() {
    var instance = new __ui_AbsolutePanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_AbsolutePanel_initialize() {
    if(__ui_AbsolutePanel.__was_initialized__) return;
    __ui_AbsolutePanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_AbsolutePanel, __ui_ComplexPanel);
    __ui_AbsolutePanel.prototype.__class__.__new__ = ui_AbsolutePanel;
    __ui_AbsolutePanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.setElement(DOM_createDiv());
    DOM_setStyleAttribute(this.getElement(), 'position', 'relative');
    DOM_setStyleAttribute(this.getElement(), 'overflow', 'hidden');
    };
    __ui_AbsolutePanel.prototype.__class__.__init__ = function() {
        return __ui_AbsolutePanel.prototype.__init__.call.apply(__ui_AbsolutePanel.prototype.__init__, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.__init__.unbound_method = true;
    __ui_AbsolutePanel.prototype.__init__.instance_method = true;
    __ui_AbsolutePanel.prototype.add = function(widget, left, top) {
    if (typeof left == 'undefined') left=null;
    if (typeof top == 'undefined') top=null;
    __ui_ComplexPanel.prototype.__class__.add(this, widget, this.getElement());
    if ((left != null)) {
    this.setWidgetPosition(widget, left, top);
    }
    };
__ui_AbsolutePanel.prototype.add.parse_kwargs = function ( __kwargs, widget, left, top ) {
    if (typeof left == 'undefined')
        left=__kwargs.left;
    if (typeof top == 'undefined')
        top=__kwargs.top;
    var __r = [widget, left, top];
    return __r;
};
    __ui_AbsolutePanel.prototype.__class__.add = function() {
        return __ui_AbsolutePanel.prototype.add.call.apply(__ui_AbsolutePanel.prototype.add, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.add.unbound_method = true;
    __ui_AbsolutePanel.prototype.add.instance_method = true;
    __ui_AbsolutePanel.prototype.__class__.add.parse_kwargs = __ui_AbsolutePanel.prototype.add.parse_kwargs;
    __ui_AbsolutePanel.prototype.setWidgetPosition = function(widget, left, top) {
    this.checkWidgetParent(widget);
    var h = widget.getElement();
    if (((left == -1)) && ((top == -1))) {
    DOM_setStyleAttribute(h, 'left', '');
    DOM_setStyleAttribute(h, 'top', '');
    DOM_setStyleAttribute(h, 'position', 'static');
    }
    else {
    DOM_setStyleAttribute(h, 'position', 'absolute');
    DOM_setStyleAttribute(h, 'left',  ( left + 'px' ) );
    DOM_setStyleAttribute(h, 'top',  ( top + 'px' ) );
    }
    };
    __ui_AbsolutePanel.prototype.__class__.setWidgetPosition = function() {
        return __ui_AbsolutePanel.prototype.setWidgetPosition.call.apply(__ui_AbsolutePanel.prototype.setWidgetPosition, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.setWidgetPosition.unbound_method = true;
    __ui_AbsolutePanel.prototype.setWidgetPosition.instance_method = true;
    __ui_AbsolutePanel.prototype.getWidgetLeft = function(widget) {
    this.checkWidgetParent(widget);
    return DOM_getIntAttribute(widget.getElement(), 'offsetLeft');
    };
    __ui_AbsolutePanel.prototype.__class__.getWidgetLeft = function() {
        return __ui_AbsolutePanel.prototype.getWidgetLeft.call.apply(__ui_AbsolutePanel.prototype.getWidgetLeft, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.getWidgetLeft.unbound_method = true;
    __ui_AbsolutePanel.prototype.getWidgetLeft.instance_method = true;
    __ui_AbsolutePanel.prototype.getWidgetTop = function(widget) {
    this.checkWidgetParent(widget);
    return DOM_getIntAttribute(widget.getElement(), 'offsetTop');
    };
    __ui_AbsolutePanel.prototype.__class__.getWidgetTop = function() {
        return __ui_AbsolutePanel.prototype.getWidgetTop.call.apply(__ui_AbsolutePanel.prototype.getWidgetTop, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.getWidgetTop.unbound_method = true;
    __ui_AbsolutePanel.prototype.getWidgetTop.instance_method = true;
    __ui_AbsolutePanel.prototype.checkWidgetParent = function(widget) {
    if ((widget.getParent() != this)) {
    console.error('Widget must be a child of this panel.');
    }
    };
    __ui_AbsolutePanel.prototype.__class__.checkWidgetParent = function() {
        return __ui_AbsolutePanel.prototype.checkWidgetParent.call.apply(__ui_AbsolutePanel.prototype.checkWidgetParent, arguments);
    };
    __ui_AbsolutePanel.prototype.__class__.checkWidgetParent.unbound_method = true;
    __ui_AbsolutePanel.prototype.checkWidgetParent.instance_method = true;
}
function __ui_Label() {
}
function ui_Label(text, wordWrap) {
    if (typeof text == 'undefined') text=null;
    if (typeof wordWrap == 'undefined') wordWrap=true;
    var instance = new __ui_Label();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Label.parse_kwargs = function ( __kwargs, text, wordWrap ) {
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof wordWrap == 'undefined')
        wordWrap=__kwargs.wordWrap;
    var __r = [text, wordWrap];
    return __r;
};
function __ui_Label_initialize() {
    if(__ui_Label.__was_initialized__) return;
    __ui_Label.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Label, __ui_Widget);
    __ui_Label.prototype.__class__.__new__ = ui_Label;
    __ui_Label.prototype.__init__ = function(text, wordWrap) {
    if (typeof text == 'undefined') text=null;
    if (typeof wordWrap == 'undefined') wordWrap=true;
    __ui_Widget.prototype.__class__.__init__(this);
    this.horzAlign = '';
    this.clickListeners = new pyjslib_List([]);
    this.mouseListeners = new pyjslib_List([]);
    this.setElement(DOM_createDiv());
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.MOUSEEVENTS));
    this.setStyleName('gwt-Label');
    if (text) {
    this.setText(text);
    }
    this.setWordWrap(wordWrap);
    };
__ui_Label.prototype.__init__.parse_kwargs = function ( __kwargs, text, wordWrap ) {
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof wordWrap == 'undefined')
        wordWrap=__kwargs.wordWrap;
    var __r = [text, wordWrap];
    return __r;
};
    __ui_Label.prototype.__class__.__init__ = function() {
        return __ui_Label.prototype.__init__.call.apply(__ui_Label.prototype.__init__, arguments);
    };
    __ui_Label.prototype.__class__.__init__.unbound_method = true;
    __ui_Label.prototype.__init__.instance_method = true;
    __ui_Label.prototype.__class__.__init__.parse_kwargs = __ui_Label.prototype.__init__.parse_kwargs;
    __ui_Label.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_Label.prototype.__class__.addClickListener = function() {
        return __ui_Label.prototype.addClickListener.call.apply(__ui_Label.prototype.addClickListener, arguments);
    };
    __ui_Label.prototype.__class__.addClickListener.unbound_method = true;
    __ui_Label.prototype.addClickListener.instance_method = true;
    __ui_Label.prototype.addMouseListener = function(listener) {
    this.mouseListeners.append(listener);
    };
    __ui_Label.prototype.__class__.addMouseListener = function() {
        return __ui_Label.prototype.addMouseListener.call.apply(__ui_Label.prototype.addMouseListener, arguments);
    };
    __ui_Label.prototype.__class__.addMouseListener.unbound_method = true;
    __ui_Label.prototype.addMouseListener.instance_method = true;
    __ui_Label.prototype.getHorizontalAlignment = function() {
    return this.horzAlign;
    };
    __ui_Label.prototype.__class__.getHorizontalAlignment = function() {
        return __ui_Label.prototype.getHorizontalAlignment.call.apply(__ui_Label.prototype.getHorizontalAlignment, arguments);
    };
    __ui_Label.prototype.__class__.getHorizontalAlignment.unbound_method = true;
    __ui_Label.prototype.getHorizontalAlignment.instance_method = true;
    __ui_Label.prototype.getText = function() {
    return DOM_getInnerText(this.getElement());
    };
    __ui_Label.prototype.__class__.getText = function() {
        return __ui_Label.prototype.getText.call.apply(__ui_Label.prototype.getText, arguments);
    };
    __ui_Label.prototype.__class__.getText.unbound_method = true;
    __ui_Label.prototype.getText.instance_method = true;
    __ui_Label.prototype.getWordWrap = function() {
    return !((DOM_getStyleAttribute(this.getElement(), 'whiteSpace') == 'nowrap'));
    };
    __ui_Label.prototype.__class__.getWordWrap = function() {
        return __ui_Label.prototype.getWordWrap.call.apply(__ui_Label.prototype.getWordWrap, arguments);
    };
    __ui_Label.prototype.__class__.getWordWrap.unbound_method = true;
    __ui_Label.prototype.getWordWrap.instance_method = true;
    __ui_Label.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onClick) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if (((type == 'mousedown')) || ((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'mouseover')) || ((type == 'mouseout'))) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    }
    };
    __ui_Label.prototype.__class__.onBrowserEvent = function() {
        return __ui_Label.prototype.onBrowserEvent.call.apply(__ui_Label.prototype.onBrowserEvent, arguments);
    };
    __ui_Label.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Label.prototype.onBrowserEvent.instance_method = true;
    __ui_Label.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_Label.prototype.__class__.removeClickListener = function() {
        return __ui_Label.prototype.removeClickListener.call.apply(__ui_Label.prototype.removeClickListener, arguments);
    };
    __ui_Label.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_Label.prototype.removeClickListener.instance_method = true;
    __ui_Label.prototype.removeMouseListener = function(listener) {
    this.mouseListeners.remove(listener);
    };
    __ui_Label.prototype.__class__.removeMouseListener = function() {
        return __ui_Label.prototype.removeMouseListener.call.apply(__ui_Label.prototype.removeMouseListener, arguments);
    };
    __ui_Label.prototype.__class__.removeMouseListener.unbound_method = true;
    __ui_Label.prototype.removeMouseListener.instance_method = true;
    __ui_Label.prototype.setHorizontalAlignment = function(align) {
    this.horzAlign = align;
    DOM_setStyleAttribute(this.getElement(), 'textAlign', align);
    };
    __ui_Label.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_Label.prototype.setHorizontalAlignment.call.apply(__ui_Label.prototype.setHorizontalAlignment, arguments);
    };
    __ui_Label.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_Label.prototype.setHorizontalAlignment.instance_method = true;
    __ui_Label.prototype.setText = function(text) {
    DOM_setInnerText(this.getElement(), text);
    };
    __ui_Label.prototype.__class__.setText = function() {
        return __ui_Label.prototype.setText.call.apply(__ui_Label.prototype.setText, arguments);
    };
    __ui_Label.prototype.__class__.setText.unbound_method = true;
    __ui_Label.prototype.setText.instance_method = true;
    __ui_Label.prototype.setWordWrap = function(wrap) {
    if (wrap) {
    var style = 'normal';
    }
    else {
    var style = 'nowrap';
    }
    DOM_setStyleAttribute(this.getElement(), 'whiteSpace', style);
    };
    __ui_Label.prototype.__class__.setWordWrap = function() {
        return __ui_Label.prototype.setWordWrap.call.apply(__ui_Label.prototype.setWordWrap, arguments);
    };
    __ui_Label.prototype.__class__.setWordWrap.unbound_method = true;
    __ui_Label.prototype.setWordWrap.instance_method = true;
}
function __ui_HTML() {
}
function ui_HTML(html, wordWrap) {
    if (typeof html == 'undefined') html=null;
    if (typeof wordWrap == 'undefined') wordWrap=true;
    var instance = new __ui_HTML();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_HTML.parse_kwargs = function ( __kwargs, html, wordWrap ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    if (typeof wordWrap == 'undefined')
        wordWrap=__kwargs.wordWrap;
    var __r = [html, wordWrap];
    return __r;
};
function __ui_HTML_initialize() {
    if(__ui_HTML.__was_initialized__) return;
    __ui_HTML.__was_initialized__ = true;
    if(!__ui_Label.__was_initialized__)
        __ui_Label_initialize();
    pyjs_extend(__ui_HTML, __ui_Label);
    __ui_HTML.prototype.__class__.__new__ = ui_HTML;
    __ui_HTML.prototype.__init__ = function(html, wordWrap) {
    if (typeof html == 'undefined') html=null;
    if (typeof wordWrap == 'undefined') wordWrap=true;
    __ui_Label.prototype.__class__.__init__(this);
    this.setElement(DOM_createDiv());
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.MOUSEEVENTS));
    this.setStyleName('gwt-HTML');
    if (html) {
    this.setHTML(html);
    }
    this.setWordWrap(wordWrap);
    };
__ui_HTML.prototype.__init__.parse_kwargs = function ( __kwargs, html, wordWrap ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    if (typeof wordWrap == 'undefined')
        wordWrap=__kwargs.wordWrap;
    var __r = [html, wordWrap];
    return __r;
};
    __ui_HTML.prototype.__class__.__init__ = function() {
        return __ui_HTML.prototype.__init__.call.apply(__ui_HTML.prototype.__init__, arguments);
    };
    __ui_HTML.prototype.__class__.__init__.unbound_method = true;
    __ui_HTML.prototype.__init__.instance_method = true;
    __ui_HTML.prototype.__class__.__init__.parse_kwargs = __ui_HTML.prototype.__init__.parse_kwargs;
    __ui_HTML.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.getElement());
    };
    __ui_HTML.prototype.__class__.getHTML = function() {
        return __ui_HTML.prototype.getHTML.call.apply(__ui_HTML.prototype.getHTML, arguments);
    };
    __ui_HTML.prototype.__class__.getHTML.unbound_method = true;
    __ui_HTML.prototype.getHTML.instance_method = true;
    __ui_HTML.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.getElement(), html);
    };
    __ui_HTML.prototype.__class__.setHTML = function() {
        return __ui_HTML.prototype.setHTML.call.apply(__ui_HTML.prototype.setHTML, arguments);
    };
    __ui_HTML.prototype.__class__.setHTML.unbound_method = true;
    __ui_HTML.prototype.setHTML.instance_method = true;
}
function __ui_HasHorizontalAlignment() {
}
function ui_HasHorizontalAlignment() {
    var instance = new __ui_HasHorizontalAlignment();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HasHorizontalAlignment_initialize() {
    if(__ui_HasHorizontalAlignment.__was_initialized__) return;
    __ui_HasHorizontalAlignment.__was_initialized__ = true;
    pyjs_extend(__ui_HasHorizontalAlignment, __pyjslib_Object);
    __ui_HasHorizontalAlignment.prototype.__class__.__new__ = ui_HasHorizontalAlignment;
    __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_LEFT = 'left';
    __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_CENTER = 'center';
    __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_RIGHT = 'right';
}
function __ui_HasVerticalAlignment() {
}
function ui_HasVerticalAlignment() {
    var instance = new __ui_HasVerticalAlignment();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HasVerticalAlignment_initialize() {
    if(__ui_HasVerticalAlignment.__was_initialized__) return;
    __ui_HasVerticalAlignment.__was_initialized__ = true;
    pyjs_extend(__ui_HasVerticalAlignment, __pyjslib_Object);
    __ui_HasVerticalAlignment.prototype.__class__.__new__ = ui_HasVerticalAlignment;
    __ui_HasVerticalAlignment.prototype.__class__.ALIGN_TOP = 'top';
    __ui_HasVerticalAlignment.prototype.__class__.ALIGN_MIDDLE = 'middle';
    __ui_HasVerticalAlignment.prototype.__class__.ALIGN_BOTTOM = 'bottom';
}
function __ui_HasAlignment() {
}
function ui_HasAlignment() {
    var instance = new __ui_HasAlignment();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HasAlignment_initialize() {
    if(__ui_HasAlignment.__was_initialized__) return;
    __ui_HasAlignment.__was_initialized__ = true;
    pyjs_extend(__ui_HasAlignment, __pyjslib_Object);
    __ui_HasAlignment.prototype.__class__.__new__ = ui_HasAlignment;
    __ui_HasAlignment.prototype.__class__.ALIGN_BOTTOM = 'bottom';
    __ui_HasAlignment.prototype.__class__.ALIGN_MIDDLE = 'middle';
    __ui_HasAlignment.prototype.__class__.ALIGN_TOP = 'top';
    __ui_HasAlignment.prototype.__class__.ALIGN_CENTER = 'center';
    __ui_HasAlignment.prototype.__class__.ALIGN_LEFT = 'left';
    __ui_HasAlignment.prototype.__class__.ALIGN_RIGHT = 'right';
}
function __ui_CellPanel() {
}
function ui_CellPanel() {
    var instance = new __ui_CellPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_CellPanel_initialize() {
    if(__ui_CellPanel.__was_initialized__) return;
    __ui_CellPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_CellPanel, __ui_ComplexPanel);
    __ui_CellPanel.prototype.__class__.__new__ = ui_CellPanel;
    __ui_CellPanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.table = DOM_createTable();
    this.body = DOM_createTBody();
    this.spacing = null;
    this.padding = null;
    DOM_appendChild(this.table, this.body);
    this.setElement(this.table);
    };
    __ui_CellPanel.prototype.__class__.__init__ = function() {
        return __ui_CellPanel.prototype.__init__.call.apply(__ui_CellPanel.prototype.__init__, arguments);
    };
    __ui_CellPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_CellPanel.prototype.__init__.instance_method = true;
    __ui_CellPanel.prototype.getTable = function() {
    return this.table;
    };
    __ui_CellPanel.prototype.__class__.getTable = function() {
        return __ui_CellPanel.prototype.getTable.call.apply(__ui_CellPanel.prototype.getTable, arguments);
    };
    __ui_CellPanel.prototype.__class__.getTable.unbound_method = true;
    __ui_CellPanel.prototype.getTable.instance_method = true;
    __ui_CellPanel.prototype.getBody = function() {
    return this.body;
    };
    __ui_CellPanel.prototype.__class__.getBody = function() {
        return __ui_CellPanel.prototype.getBody.call.apply(__ui_CellPanel.prototype.getBody, arguments);
    };
    __ui_CellPanel.prototype.__class__.getBody.unbound_method = true;
    __ui_CellPanel.prototype.getBody.instance_method = true;
    __ui_CellPanel.prototype.getSpacing = function() {
    return this.spacing;
    };
    __ui_CellPanel.prototype.__class__.getSpacing = function() {
        return __ui_CellPanel.prototype.getSpacing.call.apply(__ui_CellPanel.prototype.getSpacing, arguments);
    };
    __ui_CellPanel.prototype.__class__.getSpacing.unbound_method = true;
    __ui_CellPanel.prototype.getSpacing.instance_method = true;
    __ui_CellPanel.prototype.getPadding = function() {
    return this.padding;
    };
    __ui_CellPanel.prototype.__class__.getPadding = function() {
        return __ui_CellPanel.prototype.getPadding.call.apply(__ui_CellPanel.prototype.getPadding, arguments);
    };
    __ui_CellPanel.prototype.__class__.getPadding.unbound_method = true;
    __ui_CellPanel.prototype.getPadding.instance_method = true;
    __ui_CellPanel.prototype.getWidgetTd = function(widget) {
    if ((widget.getParent() != this)) {
    return;
    }
    return DOM_getParent(widget.getElement());
    };
    __ui_CellPanel.prototype.__class__.getWidgetTd = function() {
        return __ui_CellPanel.prototype.getWidgetTd.call.apply(__ui_CellPanel.prototype.getWidgetTd, arguments);
    };
    __ui_CellPanel.prototype.__class__.getWidgetTd.unbound_method = true;
    __ui_CellPanel.prototype.getWidgetTd.instance_method = true;
    __ui_CellPanel.prototype.setBorderWidth = function(width) {
    DOM_setAttribute(this.table, 'border',  ( '' + width ) );
    };
    __ui_CellPanel.prototype.__class__.setBorderWidth = function() {
        return __ui_CellPanel.prototype.setBorderWidth.call.apply(__ui_CellPanel.prototype.setBorderWidth, arguments);
    };
    __ui_CellPanel.prototype.__class__.setBorderWidth.unbound_method = true;
    __ui_CellPanel.prototype.setBorderWidth.instance_method = true;
    __ui_CellPanel.prototype.setCellHeight = function(widget, height) {
    var td = DOM_getParent(widget.getElement());
    DOM_setAttribute(td, 'height', height);
    };
    __ui_CellPanel.prototype.__class__.setCellHeight = function() {
        return __ui_CellPanel.prototype.setCellHeight.call.apply(__ui_CellPanel.prototype.setCellHeight, arguments);
    };
    __ui_CellPanel.prototype.__class__.setCellHeight.unbound_method = true;
    __ui_CellPanel.prototype.setCellHeight.instance_method = true;
    __ui_CellPanel.prototype.setCellHorizontalAlignment = function(widget, align) {
    var td = this.getWidgetTd(widget);
    if ((td != null)) {
    DOM_setAttribute(td, 'align', align);
    }
    };
    __ui_CellPanel.prototype.__class__.setCellHorizontalAlignment = function() {
        return __ui_CellPanel.prototype.setCellHorizontalAlignment.call.apply(__ui_CellPanel.prototype.setCellHorizontalAlignment, arguments);
    };
    __ui_CellPanel.prototype.__class__.setCellHorizontalAlignment.unbound_method = true;
    __ui_CellPanel.prototype.setCellHorizontalAlignment.instance_method = true;
    __ui_CellPanel.prototype.setCellVerticalAlignment = function(widget, align) {
    var td = this.getWidgetTd(widget);
    if ((td != null)) {
    DOM_setStyleAttribute(td, 'verticalAlign', align);
    }
    };
    __ui_CellPanel.prototype.__class__.setCellVerticalAlignment = function() {
        return __ui_CellPanel.prototype.setCellVerticalAlignment.call.apply(__ui_CellPanel.prototype.setCellVerticalAlignment, arguments);
    };
    __ui_CellPanel.prototype.__class__.setCellVerticalAlignment.unbound_method = true;
    __ui_CellPanel.prototype.setCellVerticalAlignment.instance_method = true;
    __ui_CellPanel.prototype.setCellWidth = function(widget, width) {
    var td = DOM_getParent(widget.getElement());
    DOM_setAttribute(td, 'width', width);
    };
    __ui_CellPanel.prototype.__class__.setCellWidth = function() {
        return __ui_CellPanel.prototype.setCellWidth.call.apply(__ui_CellPanel.prototype.setCellWidth, arguments);
    };
    __ui_CellPanel.prototype.__class__.setCellWidth.unbound_method = true;
    __ui_CellPanel.prototype.setCellWidth.instance_method = true;
    __ui_CellPanel.prototype.setSpacing = function(spacing) {
    this.spacing = spacing;
    DOM_setIntAttribute(this.table, 'cellSpacing', spacing);
    };
    __ui_CellPanel.prototype.__class__.setSpacing = function() {
        return __ui_CellPanel.prototype.setSpacing.call.apply(__ui_CellPanel.prototype.setSpacing, arguments);
    };
    __ui_CellPanel.prototype.__class__.setSpacing.unbound_method = true;
    __ui_CellPanel.prototype.setSpacing.instance_method = true;
    __ui_CellPanel.prototype.setPadding = function(padding) {
    this.padding = padding;
    DOM_setIntAttribute(this.table, 'cellPadding', padding);
    };
    __ui_CellPanel.prototype.__class__.setPadding = function() {
        return __ui_CellPanel.prototype.setPadding.call.apply(__ui_CellPanel.prototype.setPadding, arguments);
    };
    __ui_CellPanel.prototype.__class__.setPadding.unbound_method = true;
    __ui_CellPanel.prototype.setPadding.instance_method = true;
}
function __ui_HorizontalPanel() {
}
function ui_HorizontalPanel() {
    var instance = new __ui_HorizontalPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HorizontalPanel_initialize() {
    if(__ui_HorizontalPanel.__was_initialized__) return;
    __ui_HorizontalPanel.__was_initialized__ = true;
    if(!__ui_CellPanel.__was_initialized__)
        __ui_CellPanel_initialize();
    pyjs_extend(__ui_HorizontalPanel, __ui_CellPanel);
    __ui_HorizontalPanel.prototype.__class__.__new__ = ui_HorizontalPanel;
    __ui_HorizontalPanel.prototype.__init__ = function() {
    __ui_CellPanel.prototype.__class__.__init__(this);
    this.horzAlign = __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_LEFT;
    this.vertAlign = __ui_HasVerticalAlignment.prototype.__class__.ALIGN_TOP;
    this.tableRow = DOM_createTR();
    DOM_appendChild(this.getBody(), this.tableRow);
    DOM_setAttribute(this.getTable(), 'cellSpacing', '0');
    DOM_setAttribute(this.getTable(), 'cellPadding', '0');
    };
    __ui_HorizontalPanel.prototype.__class__.__init__ = function() {
        return __ui_HorizontalPanel.prototype.__init__.call.apply(__ui_HorizontalPanel.prototype.__init__, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_HorizontalPanel.prototype.__init__.instance_method = true;
    __ui_HorizontalPanel.prototype.add = function(widget) {
    this.insert(widget, this.getWidgetCount());
    };
    __ui_HorizontalPanel.prototype.__class__.add = function() {
        return __ui_HorizontalPanel.prototype.add.call.apply(__ui_HorizontalPanel.prototype.add, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.add.unbound_method = true;
    __ui_HorizontalPanel.prototype.add.instance_method = true;
    __ui_HorizontalPanel.prototype.getHorizontalAlignment = function() {
    return this.horzAlign;
    };
    __ui_HorizontalPanel.prototype.__class__.getHorizontalAlignment = function() {
        return __ui_HorizontalPanel.prototype.getHorizontalAlignment.call.apply(__ui_HorizontalPanel.prototype.getHorizontalAlignment, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getHorizontalAlignment.unbound_method = true;
    __ui_HorizontalPanel.prototype.getHorizontalAlignment.instance_method = true;
    __ui_HorizontalPanel.prototype.getVerticalAlignment = function() {
    return this.vertAlign;
    };
    __ui_HorizontalPanel.prototype.__class__.getVerticalAlignment = function() {
        return __ui_HorizontalPanel.prototype.getVerticalAlignment.call.apply(__ui_HorizontalPanel.prototype.getVerticalAlignment, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getVerticalAlignment.unbound_method = true;
    __ui_HorizontalPanel.prototype.getVerticalAlignment.instance_method = true;
    __ui_HorizontalPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidget = function() {
        return __ui_HorizontalPanel.prototype.getWidget.call.apply(__ui_HorizontalPanel.prototype.getWidget, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_HorizontalPanel.prototype.getWidget.instance_method = true;
    __ui_HorizontalPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_HorizontalPanel.prototype.getWidgetCount.call.apply(__ui_HorizontalPanel.prototype.getWidgetCount, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_HorizontalPanel.prototype.getWidgetCount.instance_method = true;
    __ui_HorizontalPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_HorizontalPanel.prototype.getWidgetIndex.call.apply(__ui_HorizontalPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_HorizontalPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_HorizontalPanel.prototype.insert = function(widget, beforeIndex) {
    widget.removeFromParent();
    var td = DOM_createTD();
    DOM_insertChild(this.tableRow, td, beforeIndex);
    __ui_CellPanel.prototype.__class__.insert(this, widget, td, beforeIndex);
    this.setCellHorizontalAlignment(widget, this.horzAlign);
    this.setCellVerticalAlignment(widget, this.vertAlign);
    };
    __ui_HorizontalPanel.prototype.__class__.insert = function() {
        return __ui_HorizontalPanel.prototype.insert.call.apply(__ui_HorizontalPanel.prototype.insert, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.insert.unbound_method = true;
    __ui_HorizontalPanel.prototype.insert.instance_method = true;
    __ui_HorizontalPanel.prototype.remove = function(widget) {
    if (pyjslib_isNumber(widget)) {
    var widget = this.getWidget(widget);
    }
    if ((widget.getParent() != this)) {
    return false;
    }
    var td = DOM_getParent(widget.getElement());
    DOM_removeChild(this.tableRow, td);
    __ui_CellPanel.prototype.__class__.remove(this, widget);
    return true;
    };
    __ui_HorizontalPanel.prototype.__class__.remove = function() {
        return __ui_HorizontalPanel.prototype.remove.call.apply(__ui_HorizontalPanel.prototype.remove, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.remove.unbound_method = true;
    __ui_HorizontalPanel.prototype.remove.instance_method = true;
    __ui_HorizontalPanel.prototype.setHorizontalAlignment = function(align) {
    this.horzAlign = align;
    };
    __ui_HorizontalPanel.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_HorizontalPanel.prototype.setHorizontalAlignment.call.apply(__ui_HorizontalPanel.prototype.setHorizontalAlignment, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_HorizontalPanel.prototype.setHorizontalAlignment.instance_method = true;
    __ui_HorizontalPanel.prototype.setVerticalAlignment = function(align) {
    this.vertAlign = align;
    };
    __ui_HorizontalPanel.prototype.__class__.setVerticalAlignment = function() {
        return __ui_HorizontalPanel.prototype.setVerticalAlignment.call.apply(__ui_HorizontalPanel.prototype.setVerticalAlignment, arguments);
    };
    __ui_HorizontalPanel.prototype.__class__.setVerticalAlignment.unbound_method = true;
    __ui_HorizontalPanel.prototype.setVerticalAlignment.instance_method = true;
}
function __ui_VerticalPanel() {
}
function ui_VerticalPanel() {
    var instance = new __ui_VerticalPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_VerticalPanel_initialize() {
    if(__ui_VerticalPanel.__was_initialized__) return;
    __ui_VerticalPanel.__was_initialized__ = true;
    if(!__ui_CellPanel.__was_initialized__)
        __ui_CellPanel_initialize();
    pyjs_extend(__ui_VerticalPanel, __ui_CellPanel);
    __ui_VerticalPanel.prototype.__class__.__new__ = ui_VerticalPanel;
    __ui_VerticalPanel.prototype.__init__ = function() {
    __ui_CellPanel.prototype.__class__.__init__(this);
    this.horzAlign = __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_LEFT;
    this.vertAlign = __ui_HasVerticalAlignment.prototype.__class__.ALIGN_TOP;
    DOM_setAttribute(this.getTable(), 'cellSpacing', '0');
    DOM_setAttribute(this.getTable(), 'cellPadding', '0');
    };
    __ui_VerticalPanel.prototype.__class__.__init__ = function() {
        return __ui_VerticalPanel.prototype.__init__.call.apply(__ui_VerticalPanel.prototype.__init__, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_VerticalPanel.prototype.__init__.instance_method = true;
    __ui_VerticalPanel.prototype.add = function(widget) {
    this.insert(widget, this.getWidgetCount());
    };
    __ui_VerticalPanel.prototype.__class__.add = function() {
        return __ui_VerticalPanel.prototype.add.call.apply(__ui_VerticalPanel.prototype.add, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.add.unbound_method = true;
    __ui_VerticalPanel.prototype.add.instance_method = true;
    __ui_VerticalPanel.prototype.getHorizontalAlignment = function() {
    return this.horzAlign;
    };
    __ui_VerticalPanel.prototype.__class__.getHorizontalAlignment = function() {
        return __ui_VerticalPanel.prototype.getHorizontalAlignment.call.apply(__ui_VerticalPanel.prototype.getHorizontalAlignment, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getHorizontalAlignment.unbound_method = true;
    __ui_VerticalPanel.prototype.getHorizontalAlignment.instance_method = true;
    __ui_VerticalPanel.prototype.getVerticalAlignment = function() {
    return this.vertAlign;
    };
    __ui_VerticalPanel.prototype.__class__.getVerticalAlignment = function() {
        return __ui_VerticalPanel.prototype.getVerticalAlignment.call.apply(__ui_VerticalPanel.prototype.getVerticalAlignment, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getVerticalAlignment.unbound_method = true;
    __ui_VerticalPanel.prototype.getVerticalAlignment.instance_method = true;
    __ui_VerticalPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_VerticalPanel.prototype.__class__.getWidget = function() {
        return __ui_VerticalPanel.prototype.getWidget.call.apply(__ui_VerticalPanel.prototype.getWidget, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_VerticalPanel.prototype.getWidget.instance_method = true;
    __ui_VerticalPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_VerticalPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_VerticalPanel.prototype.getWidgetCount.call.apply(__ui_VerticalPanel.prototype.getWidgetCount, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_VerticalPanel.prototype.getWidgetCount.instance_method = true;
    __ui_VerticalPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_VerticalPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_VerticalPanel.prototype.getWidgetIndex.call.apply(__ui_VerticalPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_VerticalPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_VerticalPanel.prototype.setWidget = function(index, widget) {
    var existing = this.getWidget(index);
    if (existing) {
    this.remove(existing);
    }
    this.insert(widget, index);
    };
    __ui_VerticalPanel.prototype.__class__.setWidget = function() {
        return __ui_VerticalPanel.prototype.setWidget.call.apply(__ui_VerticalPanel.prototype.setWidget, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.setWidget.unbound_method = true;
    __ui_VerticalPanel.prototype.setWidget.instance_method = true;
    __ui_VerticalPanel.prototype.insert = function(widget, beforeIndex) {
    widget.removeFromParent();
    var tr = DOM_createTR();
    var td = DOM_createTD();
    DOM_insertChild(this.getBody(), tr, beforeIndex);
    DOM_appendChild(tr, td);
    __ui_CellPanel.prototype.__class__.insert(this, widget, td, beforeIndex);
    this.setCellHorizontalAlignment(widget, this.horzAlign);
    this.setCellVerticalAlignment(widget, this.vertAlign);
    };
    __ui_VerticalPanel.prototype.__class__.insert = function() {
        return __ui_VerticalPanel.prototype.insert.call.apply(__ui_VerticalPanel.prototype.insert, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.insert.unbound_method = true;
    __ui_VerticalPanel.prototype.insert.instance_method = true;
    __ui_VerticalPanel.prototype.remove = function(widget) {
    if (pyjslib_isNumber(widget)) {
    var widget = this.getWidget(widget);
    }
    if ((widget.getParent() != this)) {
    return false;
    }
    var td = DOM_getParent(widget.getElement());
    var tr = DOM_getParent(td);
    DOM_removeChild(this.getBody(), tr);
    __ui_CellPanel.prototype.__class__.remove(this, widget);
    return true;
    };
    __ui_VerticalPanel.prototype.__class__.remove = function() {
        return __ui_VerticalPanel.prototype.remove.call.apply(__ui_VerticalPanel.prototype.remove, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.remove.unbound_method = true;
    __ui_VerticalPanel.prototype.remove.instance_method = true;
    __ui_VerticalPanel.prototype.setHorizontalAlignment = function(align) {
    this.horzAlign = align;
    };
    __ui_VerticalPanel.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_VerticalPanel.prototype.setHorizontalAlignment.call.apply(__ui_VerticalPanel.prototype.setHorizontalAlignment, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_VerticalPanel.prototype.setHorizontalAlignment.instance_method = true;
    __ui_VerticalPanel.prototype.setVerticalAlignment = function(align) {
    this.vertAlign = align;
    };
    __ui_VerticalPanel.prototype.__class__.setVerticalAlignment = function() {
        return __ui_VerticalPanel.prototype.setVerticalAlignment.call.apply(__ui_VerticalPanel.prototype.setVerticalAlignment, arguments);
    };
    __ui_VerticalPanel.prototype.__class__.setVerticalAlignment.unbound_method = true;
    __ui_VerticalPanel.prototype.setVerticalAlignment.instance_method = true;
}
function __ui_LayoutData() {
}
function ui_LayoutData(direction) {
    var instance = new __ui_LayoutData();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_LayoutData_initialize() {
    if(__ui_LayoutData.__was_initialized__) return;
    __ui_LayoutData.__was_initialized__ = true;
    pyjs_extend(__ui_LayoutData, __pyjslib_Object);
    __ui_LayoutData.prototype.__class__.__new__ = ui_LayoutData;
    __ui_LayoutData.prototype.__init__ = function(direction) {
    this.direction = direction;
    this.hAlign = 'left';
    this.height = '';
    this.td = null;
    this.vAlign = 'top';
    this.width = '';
    };
    __ui_LayoutData.prototype.__class__.__init__ = function() {
        return __ui_LayoutData.prototype.__init__.call.apply(__ui_LayoutData.prototype.__init__, arguments);
    };
    __ui_LayoutData.prototype.__class__.__init__.unbound_method = true;
    __ui_LayoutData.prototype.__init__.instance_method = true;
}
function __ui_DockPanel() {
}
function ui_DockPanel() {
    var instance = new __ui_DockPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DockPanel_initialize() {
    if(__ui_DockPanel.__was_initialized__) return;
    __ui_DockPanel.__was_initialized__ = true;
    if(!__ui_CellPanel.__was_initialized__)
        __ui_CellPanel_initialize();
    pyjs_extend(__ui_DockPanel, __ui_CellPanel);
    __ui_DockPanel.prototype.__class__.__new__ = ui_DockPanel;
    __ui_DockPanel.prototype.__class__.CENTER = 'center';
    __ui_DockPanel.prototype.__class__.EAST = 'east';
    __ui_DockPanel.prototype.__class__.NORTH = 'north';
    __ui_DockPanel.prototype.__class__.SOUTH = 'south';
    __ui_DockPanel.prototype.__class__.WEST = 'west';
    __ui_DockPanel.prototype.__init__ = function() {
    __ui_CellPanel.prototype.__class__.__init__(this);
    this.horzAlign = __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_LEFT;
    this.vertAlign = __ui_HasVerticalAlignment.prototype.__class__.ALIGN_TOP;
    this.center = null;
    this.dock_children = new pyjslib_List([]);
    DOM_setIntAttribute(this.getTable(), 'cellSpacing', 0);
    DOM_setIntAttribute(this.getTable(), 'cellPadding', 0);
    };
    __ui_DockPanel.prototype.__class__.__init__ = function() {
        return __ui_DockPanel.prototype.__init__.call.apply(__ui_DockPanel.prototype.__init__, arguments);
    };
    __ui_DockPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_DockPanel.prototype.__init__.instance_method = true;
    __ui_DockPanel.prototype.add = function(widget, direction) {
    if ((direction == this.CENTER)) {
    if ((this.center != null)) {
    console.error('Only one CENTER widget may be added');
    }
    this.center = widget;
    }
    var layout = ui_LayoutData(direction);
    widget.setLayoutData(layout);
    this.setCellHorizontalAlignment(widget, this.horzAlign);
    this.setCellVerticalAlignment(widget, this.vertAlign);
    this.dock_children.append(widget);
    this.realizeTable(widget);
    };
    __ui_DockPanel.prototype.__class__.add = function() {
        return __ui_DockPanel.prototype.add.call.apply(__ui_DockPanel.prototype.add, arguments);
    };
    __ui_DockPanel.prototype.__class__.add.unbound_method = true;
    __ui_DockPanel.prototype.add.instance_method = true;
    __ui_DockPanel.prototype.getHorizontalAlignment = function() {
    return this.horzAlign;
    };
    __ui_DockPanel.prototype.__class__.getHorizontalAlignment = function() {
        return __ui_DockPanel.prototype.getHorizontalAlignment.call.apply(__ui_DockPanel.prototype.getHorizontalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.getHorizontalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.getHorizontalAlignment.instance_method = true;
    __ui_DockPanel.prototype.getVerticalAlignment = function() {
    return this.vertAlign;
    };
    __ui_DockPanel.prototype.__class__.getVerticalAlignment = function() {
        return __ui_DockPanel.prototype.getVerticalAlignment.call.apply(__ui_DockPanel.prototype.getVerticalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.getVerticalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.getVerticalAlignment.instance_method = true;
    __ui_DockPanel.prototype.getWidgetDirection = function(widget) {
    if ((widget.getParent() != this)) {
    return;
    }
    return widget.getLayoutData().direction;
    };
    __ui_DockPanel.prototype.__class__.getWidgetDirection = function() {
        return __ui_DockPanel.prototype.getWidgetDirection.call.apply(__ui_DockPanel.prototype.getWidgetDirection, arguments);
    };
    __ui_DockPanel.prototype.__class__.getWidgetDirection.unbound_method = true;
    __ui_DockPanel.prototype.getWidgetDirection.instance_method = true;
    __ui_DockPanel.prototype.remove = function(widget) {
    if ((widget == this.center)) {
    this.center = null;
    }
    var ret = __ui_CellPanel.prototype.__class__.remove(this, widget);
    if (ret) {
    this.dock_children.remove(widget);
    this.realizeTable(null);
    }
    return ret;
    };
    __ui_DockPanel.prototype.__class__.remove = function() {
        return __ui_DockPanel.prototype.remove.call.apply(__ui_DockPanel.prototype.remove, arguments);
    };
    __ui_DockPanel.prototype.__class__.remove.unbound_method = true;
    __ui_DockPanel.prototype.remove.instance_method = true;
    __ui_DockPanel.prototype.setCellHeight = function(widget, height) {
    var data = widget.getLayoutData();
    data.height = height;
    if (data.td) {
    DOM_setStyleAttribute(data.td, 'height', data.height);
    }
    };
    __ui_DockPanel.prototype.__class__.setCellHeight = function() {
        return __ui_DockPanel.prototype.setCellHeight.call.apply(__ui_DockPanel.prototype.setCellHeight, arguments);
    };
    __ui_DockPanel.prototype.__class__.setCellHeight.unbound_method = true;
    __ui_DockPanel.prototype.setCellHeight.instance_method = true;
    __ui_DockPanel.prototype.setCellHorizontalAlignment = function(widget, align) {
    var data = widget.getLayoutData();
    data.hAlign = align;
    if (data.td) {
    DOM_setAttribute(data.td, 'align', data.hAlign);
    }
    };
    __ui_DockPanel.prototype.__class__.setCellHorizontalAlignment = function() {
        return __ui_DockPanel.prototype.setCellHorizontalAlignment.call.apply(__ui_DockPanel.prototype.setCellHorizontalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.setCellHorizontalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.setCellHorizontalAlignment.instance_method = true;
    __ui_DockPanel.prototype.setCellVerticalAlignment = function(widget, align) {
    var data = widget.getLayoutData();
    data.vAlign = align;
    if (data.td) {
    DOM_setStyleAttribute(data.td, 'verticalAlign', data.vAlign);
    }
    };
    __ui_DockPanel.prototype.__class__.setCellVerticalAlignment = function() {
        return __ui_DockPanel.prototype.setCellVerticalAlignment.call.apply(__ui_DockPanel.prototype.setCellVerticalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.setCellVerticalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.setCellVerticalAlignment.instance_method = true;
    __ui_DockPanel.prototype.setCellWidth = function(widget, width) {
    var data = widget.getLayoutData();
    data.width = width;
    if (data.td) {
    DOM_setStyleAttribute(data.td, 'width', data.width);
    }
    };
    __ui_DockPanel.prototype.__class__.setCellWidth = function() {
        return __ui_DockPanel.prototype.setCellWidth.call.apply(__ui_DockPanel.prototype.setCellWidth, arguments);
    };
    __ui_DockPanel.prototype.__class__.setCellWidth.unbound_method = true;
    __ui_DockPanel.prototype.setCellWidth.instance_method = true;
    __ui_DockPanel.prototype.setHorizontalAlignment = function(align) {
    this.horzAlign = align;
    };
    __ui_DockPanel.prototype.__class__.setHorizontalAlignment = function() {
        return __ui_DockPanel.prototype.setHorizontalAlignment.call.apply(__ui_DockPanel.prototype.setHorizontalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.setHorizontalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.setHorizontalAlignment.instance_method = true;
    __ui_DockPanel.prototype.setVerticalAlignment = function(align) {
    this.vertAlign = align;
    };
    __ui_DockPanel.prototype.__class__.setVerticalAlignment = function() {
        return __ui_DockPanel.prototype.setVerticalAlignment.call.apply(__ui_DockPanel.prototype.setVerticalAlignment, arguments);
    };
    __ui_DockPanel.prototype.__class__.setVerticalAlignment.unbound_method = true;
    __ui_DockPanel.prototype.setVerticalAlignment.instance_method = true;
    __ui_DockPanel.prototype.realizeTable = function(beingAdded) {
    var bodyElement = this.getBody();
    while ((DOM_getChildCount(bodyElement) > 0)) {
    DOM_removeChild(bodyElement, DOM_getChild(bodyElement, 0));
    }
    var rowCount = 1;
    var colCount = 1;

        var __child = this.dock_children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    var dir = child.getLayoutData().direction;
    if (((dir == this.NORTH)) || ((dir == this.SOUTH))) {
    rowCount += 1;
    }
    else if (((dir == this.EAST)) || ((dir == this.WEST))) {
    colCount += 1;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    var rows = new pyjslib_List([]);

        var __i = pyjslib_range(rowCount).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    rows.__setitem__(i, ui_DockPanelTmpRow());
    rows.__getitem__(i).tr = DOM_createTR();
    DOM_appendChild(bodyElement, rows.__getitem__(i).tr);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    var westCol = 0;
    var eastCol =  ( colCount - 1 ) ;
    var northRow = 0;
    var southRow =  ( rowCount - 1 ) ;
    var centerTd = null;

        var __child = this.dock_children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    var layout = child.getLayoutData();
    var td = DOM_createTD();
    layout.td = td;
    DOM_setAttribute(layout.td, 'align', layout.hAlign);
    DOM_setStyleAttribute(layout.td, 'verticalAlign', layout.vAlign);
    DOM_setAttribute(layout.td, 'width', layout.width);
    DOM_setAttribute(layout.td, 'height', layout.height);
    if ((layout.direction == this.NORTH)) {
    DOM_insertChild(rows.__getitem__(northRow).tr, td, rows.__getitem__(northRow).center);
    this.appendAndMaybeAdopt(td, child.getElement(), beingAdded);
    DOM_setIntAttribute(td, 'colSpan',  (  ( eastCol - westCol )  + 1 ) );
    northRow += 1;
    }
    else if ((layout.direction == this.SOUTH)) {
    DOM_insertChild(rows.__getitem__(southRow).tr, td, rows.__getitem__(southRow).center);
    this.appendAndMaybeAdopt(td, child.getElement(), beingAdded);
    DOM_setIntAttribute(td, 'colSpan',  (  ( eastCol - westCol )  + 1 ) );
    southRow -= 1;
    }
    else if ((layout.direction == this.WEST)) {
    var row = rows.__getitem__(northRow);
    DOM_insertChild(row.tr, td, row.center);
    row.center += 1;
    this.appendAndMaybeAdopt(td, child.getElement(), beingAdded);
    DOM_setIntAttribute(td, 'rowSpan',  (  ( southRow - northRow )  + 1 ) );
    westCol += 1;
    }
    else if ((layout.direction == this.EAST)) {
    var row = rows.__getitem__(northRow);
    DOM_insertChild(row.tr, td, row.center);
    this.appendAndMaybeAdopt(td, child.getElement(), beingAdded);
    DOM_setIntAttribute(td, 'rowSpan',  (  ( southRow - northRow )  + 1 ) );
    eastCol -= 1;
    }
    else if ((layout.direction == this.CENTER)) {
    var centerTd = td;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    if ((this.center != null)) {
    var row = rows.__getitem__(northRow);
    DOM_insertChild(row.tr, centerTd, row.center);
    this.appendAndMaybeAdopt(centerTd, this.center.getElement(), beingAdded);
    }
    };
    __ui_DockPanel.prototype.__class__.realizeTable = function() {
        return __ui_DockPanel.prototype.realizeTable.call.apply(__ui_DockPanel.prototype.realizeTable, arguments);
    };
    __ui_DockPanel.prototype.__class__.realizeTable.unbound_method = true;
    __ui_DockPanel.prototype.realizeTable.instance_method = true;
    __ui_DockPanel.prototype.appendAndMaybeAdopt = function(parent, child, beingAdded) {
    if ((beingAdded != null)) {
    if (DOM_compare(child, beingAdded.getElement())) {
    __ui_CellPanel.prototype.__class__.add(this, beingAdded, parent);
    return;
    }
    }
    DOM_appendChild(parent, child);
    };
    __ui_DockPanel.prototype.__class__.appendAndMaybeAdopt = function() {
        return __ui_DockPanel.prototype.appendAndMaybeAdopt.call.apply(__ui_DockPanel.prototype.appendAndMaybeAdopt, arguments);
    };
    __ui_DockPanel.prototype.__class__.appendAndMaybeAdopt.unbound_method = true;
    __ui_DockPanel.prototype.appendAndMaybeAdopt.instance_method = true;
}
function __ui_DockPanelTmpRow() {
}
function ui_DockPanelTmpRow() {
    var instance = new __ui_DockPanelTmpRow();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DockPanelTmpRow_initialize() {
    if(__ui_DockPanelTmpRow.__was_initialized__) return;
    __ui_DockPanelTmpRow.__was_initialized__ = true;
    pyjs_extend(__ui_DockPanelTmpRow, __pyjslib_Object);
    __ui_DockPanelTmpRow.prototype.__class__.__new__ = ui_DockPanelTmpRow;
    __ui_DockPanelTmpRow.prototype.__class__.center = 0;
    __ui_DockPanelTmpRow.prototype.__class__.tr = null;
}
    var ui_rootPanels = new pyjslib_Dict([]);
function __ui_RootPanelCls() {
}
function ui_RootPanelCls(element) {
    if (typeof element == 'undefined') element=null;
    var instance = new __ui_RootPanelCls();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_RootPanelCls.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
function __ui_RootPanelCls_initialize() {
    if(__ui_RootPanelCls.__was_initialized__) return;
    __ui_RootPanelCls.__was_initialized__ = true;
    if(!__ui_AbsolutePanel.__was_initialized__)
        __ui_AbsolutePanel_initialize();
    pyjs_extend(__ui_RootPanelCls, __ui_AbsolutePanel);
    __ui_RootPanelCls.prototype.__class__.__new__ = ui_RootPanelCls;
    __ui_RootPanelCls.prototype.__init__ = function(element) {
    if (typeof element == 'undefined') element=null;
    __ui_AbsolutePanel.prototype.__class__.__init__(this);
    if ((element == null)) {
    var element = this.getBodyElement();
    }
    this.setElement(element);
    this.onAttach();
    };
__ui_RootPanelCls.prototype.__init__.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
    __ui_RootPanelCls.prototype.__class__.__init__ = function() {
        return __ui_RootPanelCls.prototype.__init__.call.apply(__ui_RootPanelCls.prototype.__init__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.__init__.unbound_method = true;
    __ui_RootPanelCls.prototype.__init__.instance_method = true;
    __ui_RootPanelCls.prototype.__class__.__init__.parse_kwargs = __ui_RootPanelCls.prototype.__init__.parse_kwargs;
    __ui_RootPanelCls.prototype.getBodyElement = function() {

        return $doc.body;
        
    };
    __ui_RootPanelCls.prototype.__class__.getBodyElement = function() {
        return __ui_RootPanelCls.prototype.getBodyElement.call.apply(__ui_RootPanelCls.prototype.getBodyElement, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.getBodyElement.unbound_method = true;
    __ui_RootPanelCls.prototype.getBodyElement.instance_method = true;
    __ui_RootPanelCls.prototype.__class__.get = function(id) {
    if (typeof id == 'undefined') id=null;
    if (ui_rootPanels.has_key(id)) {
    return ui_rootPanels.__getitem__(id);
    }
    var element = null;
    if (id) {
    var element = DOM_getElementById(id);
    if (!(element)) {
    return;
    }
    }
    if ((pyjslib_len(ui_rootPanels) < 1)) {
    this.hookWindowClosing();
    }
    var panel = ui_RootPanel(element);
    ui_rootPanels.__setitem__(id, panel);
    return panel;
    };
__ui_RootPanelCls.prototype.__class__.get.parse_kwargs = function ( __kwargs, id ) {
    if (typeof id == 'undefined')
        id=__kwargs.id;
    var __r = [id];
    return __r;
};
    __ui_RootPanelCls.prototype.get = function() {
        return __ui_RootPanelCls.prototype.__class__.get.apply(this.__class__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.get.class_method = true;
    __ui_RootPanelCls.prototype.get.instance_method = true;
    __ui_RootPanelCls.prototype.get.parse_kwargs = __ui_RootPanelCls.prototype.__class__.get.parse_kwargs;
    __ui_RootPanelCls.prototype.__class__.hookWindowClosing = function() {
    Window_addWindowCloseListener(this);
    };
    __ui_RootPanelCls.prototype.hookWindowClosing = function() {
        return __ui_RootPanelCls.prototype.__class__.hookWindowClosing.apply(this.__class__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.hookWindowClosing.class_method = true;
    __ui_RootPanelCls.prototype.hookWindowClosing.instance_method = true;
    __ui_RootPanelCls.prototype.__class__.onWindowClosed = function() {

        var __panel = ui_rootPanels.itervalues().__iter__();
        try {
            while (true) {
                var panel = __panel.next();
                
        
    panel.onDetach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_RootPanelCls.prototype.onWindowClosed = function() {
        return __ui_RootPanelCls.prototype.__class__.onWindowClosed.apply(this.__class__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.onWindowClosed.class_method = true;
    __ui_RootPanelCls.prototype.onWindowClosed.instance_method = true;
    __ui_RootPanelCls.prototype.__class__.onWindowClosing = function() {
    return;
    };
    __ui_RootPanelCls.prototype.onWindowClosing = function() {
        return __ui_RootPanelCls.prototype.__class__.onWindowClosing.apply(this.__class__, arguments);
    };
    __ui_RootPanelCls.prototype.__class__.onWindowClosing.class_method = true;
    __ui_RootPanelCls.prototype.onWindowClosing.instance_method = true;
}
function ui_RootPanel(element) {
    if (pyjslib_isString(element)) {
    return ui_RootPanelCls().get(element);
    }
    return ui_RootPanelCls(element);
}


function __ui_Hyperlink() {
}
function ui_Hyperlink(text, asHTML, targetHistoryToken) {
    if (typeof text == 'undefined') text='';
    if (typeof asHTML == 'undefined') asHTML=false;
    if (typeof targetHistoryToken == 'undefined') targetHistoryToken='';
    var instance = new __ui_Hyperlink();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Hyperlink.parse_kwargs = function ( __kwargs, text, asHTML, targetHistoryToken ) {
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    if (typeof targetHistoryToken == 'undefined')
        targetHistoryToken=__kwargs.targetHistoryToken;
    var __r = [text, asHTML, targetHistoryToken];
    return __r;
};
function __ui_Hyperlink_initialize() {
    if(__ui_Hyperlink.__was_initialized__) return;
    __ui_Hyperlink.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Hyperlink, __ui_Widget);
    __ui_Hyperlink.prototype.__class__.__new__ = ui_Hyperlink;
    __ui_Hyperlink.prototype.__init__ = function(text, asHTML, targetHistoryToken) {
    if (typeof text == 'undefined') text='';
    if (typeof asHTML == 'undefined') asHTML=false;
    if (typeof targetHistoryToken == 'undefined') targetHistoryToken='';
    __ui_Widget.prototype.__class__.__init__(this);
    this.clickListeners = new pyjslib_List([]);
    this.targetHistoryToken = '';
    this.setElement(DOM_createDiv());
    this.anchorElem = DOM_createAnchor();
    DOM_appendChild(this.getElement(), this.anchorElem);
    this.sinkEvents(__ui_Event.prototype.__class__.ONCLICK);
    this.setStyleName('gwt-Hyperlink');
    if (asHTML) {
    this.setHTML(text);
    }
    else {
    this.setText(text);
    }
    if (targetHistoryToken) {
    this.setTargetHistoryToken(targetHistoryToken);
    }
    };
__ui_Hyperlink.prototype.__init__.parse_kwargs = function ( __kwargs, text, asHTML, targetHistoryToken ) {
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    if (typeof targetHistoryToken == 'undefined')
        targetHistoryToken=__kwargs.targetHistoryToken;
    var __r = [text, asHTML, targetHistoryToken];
    return __r;
};
    __ui_Hyperlink.prototype.__class__.__init__ = function() {
        return __ui_Hyperlink.prototype.__init__.call.apply(__ui_Hyperlink.prototype.__init__, arguments);
    };
    __ui_Hyperlink.prototype.__class__.__init__.unbound_method = true;
    __ui_Hyperlink.prototype.__init__.instance_method = true;
    __ui_Hyperlink.prototype.__class__.__init__.parse_kwargs = __ui_Hyperlink.prototype.__init__.parse_kwargs;
    __ui_Hyperlink.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_Hyperlink.prototype.__class__.addClickListener = function() {
        return __ui_Hyperlink.prototype.addClickListener.call.apply(__ui_Hyperlink.prototype.addClickListener, arguments);
    };
    __ui_Hyperlink.prototype.__class__.addClickListener.unbound_method = true;
    __ui_Hyperlink.prototype.addClickListener.instance_method = true;
    __ui_Hyperlink.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.anchorElem);
    };
    __ui_Hyperlink.prototype.__class__.getHTML = function() {
        return __ui_Hyperlink.prototype.getHTML.call.apply(__ui_Hyperlink.prototype.getHTML, arguments);
    };
    __ui_Hyperlink.prototype.__class__.getHTML.unbound_method = true;
    __ui_Hyperlink.prototype.getHTML.instance_method = true;
    __ui_Hyperlink.prototype.getTargetHistoryToken = function() {
    return this.targetHistoryToken;
    };
    __ui_Hyperlink.prototype.__class__.getTargetHistoryToken = function() {
        return __ui_Hyperlink.prototype.getTargetHistoryToken.call.apply(__ui_Hyperlink.prototype.getTargetHistoryToken, arguments);
    };
    __ui_Hyperlink.prototype.__class__.getTargetHistoryToken.unbound_method = true;
    __ui_Hyperlink.prototype.getTargetHistoryToken.instance_method = true;
    __ui_Hyperlink.prototype.getText = function() {
    return DOM_getInnerText(this.anchorElem);
    };
    __ui_Hyperlink.prototype.__class__.getText = function() {
        return __ui_Hyperlink.prototype.getText.call.apply(__ui_Hyperlink.prototype.getText, arguments);
    };
    __ui_Hyperlink.prototype.__class__.getText.unbound_method = true;
    __ui_Hyperlink.prototype.getText.instance_method = true;
    __ui_Hyperlink.prototype.onBrowserEvent = function(event) {
    if ((DOM_eventGetType(event) == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onClick) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    History_History().newItem(this.targetHistoryToken);
    DOM_eventPreventDefault(event);
    }
    };
    __ui_Hyperlink.prototype.__class__.onBrowserEvent = function() {
        return __ui_Hyperlink.prototype.onBrowserEvent.call.apply(__ui_Hyperlink.prototype.onBrowserEvent, arguments);
    };
    __ui_Hyperlink.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Hyperlink.prototype.onBrowserEvent.instance_method = true;
    __ui_Hyperlink.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_Hyperlink.prototype.__class__.removeClickListener = function() {
        return __ui_Hyperlink.prototype.removeClickListener.call.apply(__ui_Hyperlink.prototype.removeClickListener, arguments);
    };
    __ui_Hyperlink.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_Hyperlink.prototype.removeClickListener.instance_method = true;
    __ui_Hyperlink.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.anchorElem, html);
    };
    __ui_Hyperlink.prototype.__class__.setHTML = function() {
        return __ui_Hyperlink.prototype.setHTML.call.apply(__ui_Hyperlink.prototype.setHTML, arguments);
    };
    __ui_Hyperlink.prototype.__class__.setHTML.unbound_method = true;
    __ui_Hyperlink.prototype.setHTML.instance_method = true;
    __ui_Hyperlink.prototype.setTargetHistoryToken = function(targetHistoryToken) {
    this.targetHistoryToken = targetHistoryToken;
    DOM_setAttribute(this.anchorElem, 'href',  ( '#' + targetHistoryToken ) );
    };
    __ui_Hyperlink.prototype.__class__.setTargetHistoryToken = function() {
        return __ui_Hyperlink.prototype.setTargetHistoryToken.call.apply(__ui_Hyperlink.prototype.setTargetHistoryToken, arguments);
    };
    __ui_Hyperlink.prototype.__class__.setTargetHistoryToken.unbound_method = true;
    __ui_Hyperlink.prototype.setTargetHistoryToken.instance_method = true;
    __ui_Hyperlink.prototype.setText = function(text) {
    DOM_setInnerText(this.anchorElem, text);
    };
    __ui_Hyperlink.prototype.__class__.setText = function() {
        return __ui_Hyperlink.prototype.setText.call.apply(__ui_Hyperlink.prototype.setText, arguments);
    };
    __ui_Hyperlink.prototype.__class__.setText.unbound_method = true;
    __ui_Hyperlink.prototype.setText.instance_method = true;
}
    var ui_prefetchImages = new pyjslib_Dict([]);
function __ui_Image() {
}
function ui_Image(url) {
    if (typeof url == 'undefined') url='';
    var instance = new __ui_Image();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Image.parse_kwargs = function ( __kwargs, url ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    var __r = [url];
    return __r;
};
function __ui_Image_initialize() {
    if(__ui_Image.__was_initialized__) return;
    __ui_Image.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Image, __ui_Widget);
    __ui_Image.prototype.__class__.__new__ = ui_Image;
    __ui_Image.prototype.__init__ = function(url) {
    if (typeof url == 'undefined') url='';
    __ui_Widget.prototype.__class__.__init__(this);
    this.clickListeners = new pyjslib_List([]);
    this.loadListeners = new pyjslib_List([]);
    this.mouseListeners = new pyjslib_List([]);
    this.setElement(DOM_createImg());
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.MOUSEEVENTS | __ui_Event.prototype.__class__.ONLOAD | __ui_Event.prototype.__class__.ONERROR));
    this.setStyleName('gwt-Image');
    if (url) {
    this.setUrl(url);
    }
    };
__ui_Image.prototype.__init__.parse_kwargs = function ( __kwargs, url ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    var __r = [url];
    return __r;
};
    __ui_Image.prototype.__class__.__init__ = function() {
        return __ui_Image.prototype.__init__.call.apply(__ui_Image.prototype.__init__, arguments);
    };
    __ui_Image.prototype.__class__.__init__.unbound_method = true;
    __ui_Image.prototype.__init__.instance_method = true;
    __ui_Image.prototype.__class__.__init__.parse_kwargs = __ui_Image.prototype.__init__.parse_kwargs;
    __ui_Image.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_Image.prototype.__class__.addClickListener = function() {
        return __ui_Image.prototype.addClickListener.call.apply(__ui_Image.prototype.addClickListener, arguments);
    };
    __ui_Image.prototype.__class__.addClickListener.unbound_method = true;
    __ui_Image.prototype.addClickListener.instance_method = true;
    __ui_Image.prototype.addLoadListener = function(listener) {
    this.loadListeners.append(listener);
    };
    __ui_Image.prototype.__class__.addLoadListener = function() {
        return __ui_Image.prototype.addLoadListener.call.apply(__ui_Image.prototype.addLoadListener, arguments);
    };
    __ui_Image.prototype.__class__.addLoadListener.unbound_method = true;
    __ui_Image.prototype.addLoadListener.instance_method = true;
    __ui_Image.prototype.addMouseListener = function(listener) {
    this.mouseListeners.append(listener);
    };
    __ui_Image.prototype.__class__.addMouseListener = function() {
        return __ui_Image.prototype.addMouseListener.call.apply(__ui_Image.prototype.addMouseListener, arguments);
    };
    __ui_Image.prototype.__class__.addMouseListener.unbound_method = true;
    __ui_Image.prototype.addMouseListener.instance_method = true;
    __ui_Image.prototype.getUrl = function() {
    return DOM_getAttribute(this.getElement(), 'src');
    };
    __ui_Image.prototype.__class__.getUrl = function() {
        return __ui_Image.prototype.getUrl.call.apply(__ui_Image.prototype.getUrl, arguments);
    };
    __ui_Image.prototype.__class__.getUrl.unbound_method = true;
    __ui_Image.prototype.getUrl.instance_method = true;
    __ui_Image.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onClick) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if (((type == 'mousedown')) || ((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'mouseover')) || ((type == 'mouseout'))) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    }
    else if ((type == 'load')) {

        var __listener = this.loadListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onLoad(this);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if ((type == 'error')) {

        var __listener = this.loadListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onError(this);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_Image.prototype.__class__.onBrowserEvent = function() {
        return __ui_Image.prototype.onBrowserEvent.call.apply(__ui_Image.prototype.onBrowserEvent, arguments);
    };
    __ui_Image.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Image.prototype.onBrowserEvent.instance_method = true;
    __ui_Image.prototype.prefetch = function(url) {
    var img = DOM_createImg();
    DOM_setAttribute(img, 'src', url);
    ui_prefetchImages.__setitem__(url, img);
    };
    __ui_Image.prototype.__class__.prefetch = function() {
        return __ui_Image.prototype.prefetch.call.apply(__ui_Image.prototype.prefetch, arguments);
    };
    __ui_Image.prototype.__class__.prefetch.unbound_method = true;
    __ui_Image.prototype.prefetch.instance_method = true;
    __ui_Image.prototype.setUrl = function(url) {
    DOM_setAttribute(this.getElement(), 'src', url);
    };
    __ui_Image.prototype.__class__.setUrl = function() {
        return __ui_Image.prototype.setUrl.call.apply(__ui_Image.prototype.setUrl, arguments);
    };
    __ui_Image.prototype.__class__.setUrl.unbound_method = true;
    __ui_Image.prototype.setUrl.instance_method = true;
}
function __ui_FlowPanel() {
}
function ui_FlowPanel() {
    var instance = new __ui_FlowPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FlowPanel_initialize() {
    if(__ui_FlowPanel.__was_initialized__) return;
    __ui_FlowPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_FlowPanel, __ui_ComplexPanel);
    __ui_FlowPanel.prototype.__class__.__new__ = ui_FlowPanel;
    __ui_FlowPanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.setElement(DOM_createDiv());
    };
    __ui_FlowPanel.prototype.__class__.__init__ = function() {
        return __ui_FlowPanel.prototype.__init__.call.apply(__ui_FlowPanel.prototype.__init__, arguments);
    };
    __ui_FlowPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_FlowPanel.prototype.__init__.instance_method = true;
    __ui_FlowPanel.prototype.add = function(w) {
    __ui_ComplexPanel.prototype.__class__.add(this, w, this.getElement());
    };
    __ui_FlowPanel.prototype.__class__.add = function() {
        return __ui_FlowPanel.prototype.add.call.apply(__ui_FlowPanel.prototype.add, arguments);
    };
    __ui_FlowPanel.prototype.__class__.add.unbound_method = true;
    __ui_FlowPanel.prototype.add.instance_method = true;
    __ui_FlowPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_FlowPanel.prototype.__class__.getWidget = function() {
        return __ui_FlowPanel.prototype.getWidget.call.apply(__ui_FlowPanel.prototype.getWidget, arguments);
    };
    __ui_FlowPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_FlowPanel.prototype.getWidget.instance_method = true;
    __ui_FlowPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_FlowPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_FlowPanel.prototype.getWidgetCount.call.apply(__ui_FlowPanel.prototype.getWidgetCount, arguments);
    };
    __ui_FlowPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_FlowPanel.prototype.getWidgetCount.instance_method = true;
    __ui_FlowPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_FlowPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_FlowPanel.prototype.getWidgetIndex.call.apply(__ui_FlowPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_FlowPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_FlowPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_FlowPanel.prototype.remove = function(index) {
    if (pyjslib_isNumber(index)) {
    var index = this.getWidget(index);
    }
    return __ui_ComplexPanel.prototype.__class__.remove(this, index);
    };
    __ui_FlowPanel.prototype.__class__.remove = function() {
        return __ui_FlowPanel.prototype.remove.call.apply(__ui_FlowPanel.prototype.remove, arguments);
    };
    __ui_FlowPanel.prototype.__class__.remove.unbound_method = true;
    __ui_FlowPanel.prototype.remove.instance_method = true;
}
    var ui_HTMLPanel_sUid = 0;
function __ui_HTMLPanel() {
}
function ui_HTMLPanel(html) {
    var instance = new __ui_HTMLPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_HTMLPanel_initialize() {
    if(__ui_HTMLPanel.__was_initialized__) return;
    __ui_HTMLPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_HTMLPanel, __ui_ComplexPanel);
    __ui_HTMLPanel.prototype.__class__.__new__ = ui_HTMLPanel;
    __ui_HTMLPanel.prototype.__init__ = function(html) {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.setElement(DOM_createDiv());
    DOM_setInnerHTML(this.getElement(), html);
    };
    __ui_HTMLPanel.prototype.__class__.__init__ = function() {
        return __ui_HTMLPanel.prototype.__init__.call.apply(__ui_HTMLPanel.prototype.__init__, arguments);
    };
    __ui_HTMLPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_HTMLPanel.prototype.__init__.instance_method = true;
    __ui_HTMLPanel.prototype.add = function(widget, id) {
    var element = this.getElementById(this.getElement(), id);
    if ((element == null)) {
    return;
    }
    __ui_ComplexPanel.prototype.__class__.add(this, widget, element);
    };
    __ui_HTMLPanel.prototype.__class__.add = function() {
        return __ui_HTMLPanel.prototype.add.call.apply(__ui_HTMLPanel.prototype.add, arguments);
    };
    __ui_HTMLPanel.prototype.__class__.add.unbound_method = true;
    __ui_HTMLPanel.prototype.add.instance_method = true;
    __ui_HTMLPanel.prototype.createUniqueId = function() {
    ui_HTMLPanel_sUid += 1;
    return  ( 'HTMLPanel_' + ui_HTMLPanel_sUid ) ;
    };
    __ui_HTMLPanel.prototype.__class__.createUniqueId = function() {
        return __ui_HTMLPanel.prototype.createUniqueId.call.apply(__ui_HTMLPanel.prototype.createUniqueId, arguments);
    };
    __ui_HTMLPanel.prototype.__class__.createUniqueId.unbound_method = true;
    __ui_HTMLPanel.prototype.createUniqueId.instance_method = true;
    __ui_HTMLPanel.prototype.getElementById = function(element, id) {
    var element_id = DOM_getAttribute(element, 'id');
    if (((element_id != null)) && ((element_id == id))) {
    return element;
    }
    var child = DOM_getFirstChild(element);
    while ((child != null)) {
    var ret = this.getElementById(child, id);
    if ((ret != null)) {
    return ret;
    }
    var child = DOM_getNextSibling(child);
    }
    return;
    };
    __ui_HTMLPanel.prototype.__class__.getElementById = function() {
        return __ui_HTMLPanel.prototype.getElementById.call.apply(__ui_HTMLPanel.prototype.getElementById, arguments);
    };
    __ui_HTMLPanel.prototype.__class__.getElementById.unbound_method = true;
    __ui_HTMLPanel.prototype.getElementById.instance_method = true;
}
function __ui_DeckPanel() {
}
function ui_DeckPanel() {
    var instance = new __ui_DeckPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DeckPanel_initialize() {
    if(__ui_DeckPanel.__was_initialized__) return;
    __ui_DeckPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_DeckPanel, __ui_ComplexPanel);
    __ui_DeckPanel.prototype.__class__.__new__ = ui_DeckPanel;
    __ui_DeckPanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.visibleWidget = null;
    this.setElement(DOM_createDiv());
    };
    __ui_DeckPanel.prototype.__class__.__init__ = function() {
        return __ui_DeckPanel.prototype.__init__.call.apply(__ui_DeckPanel.prototype.__init__, arguments);
    };
    __ui_DeckPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_DeckPanel.prototype.__init__.instance_method = true;
    __ui_DeckPanel.prototype.add = function(widget) {
    this.insert(widget, this.getWidgetCount());
    };
    __ui_DeckPanel.prototype.__class__.add = function() {
        return __ui_DeckPanel.prototype.add.call.apply(__ui_DeckPanel.prototype.add, arguments);
    };
    __ui_DeckPanel.prototype.__class__.add.unbound_method = true;
    __ui_DeckPanel.prototype.add.instance_method = true;
    __ui_DeckPanel.prototype.getVisibleWidget = function() {
    return this.getWidgetIndex(this.visibleWidget);
    };
    __ui_DeckPanel.prototype.__class__.getVisibleWidget = function() {
        return __ui_DeckPanel.prototype.getVisibleWidget.call.apply(__ui_DeckPanel.prototype.getVisibleWidget, arguments);
    };
    __ui_DeckPanel.prototype.__class__.getVisibleWidget.unbound_method = true;
    __ui_DeckPanel.prototype.getVisibleWidget.instance_method = true;
    __ui_DeckPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_DeckPanel.prototype.__class__.getWidget = function() {
        return __ui_DeckPanel.prototype.getWidget.call.apply(__ui_DeckPanel.prototype.getWidget, arguments);
    };
    __ui_DeckPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_DeckPanel.prototype.getWidget.instance_method = true;
    __ui_DeckPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_DeckPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_DeckPanel.prototype.getWidgetCount.call.apply(__ui_DeckPanel.prototype.getWidgetCount, arguments);
    };
    __ui_DeckPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_DeckPanel.prototype.getWidgetCount.instance_method = true;
    __ui_DeckPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_DeckPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_DeckPanel.prototype.getWidgetIndex.call.apply(__ui_DeckPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_DeckPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_DeckPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_DeckPanel.prototype.insert = function(widget, beforeIndex) {
    if (((this.beforeIndex < 0)) || ((this.beforeIndex > this.getWidgetCount()))) {
    return;
    }
    __ui_ComplexPanel.prototype.__class__.insert(this, widget, this.getElement(), beforeIndex);
    var child = widget.getElement();
    DOM_setStyleAttribute(child, 'width', '100%');
    DOM_setStyleAttribute(child, 'height', '100%');
    widget.setVisible(false);
    };
    __ui_DeckPanel.prototype.__class__.insert = function() {
        return __ui_DeckPanel.prototype.insert.call.apply(__ui_DeckPanel.prototype.insert, arguments);
    };
    __ui_DeckPanel.prototype.__class__.insert.unbound_method = true;
    __ui_DeckPanel.prototype.insert.instance_method = true;
    __ui_DeckPanel.prototype.remove = function(widget) {
    if (pyjslib_isNumber(widget)) {
    var widget = this.getWidget(widget);
    }
    if (!(__ui_ComplexPanel.prototype.__class__.remove(this, widget))) {
    return false;
    }
    if ((this.visibleWidget == widget)) {
    this.visibleWidget = null;
    }
    return true;
    };
    __ui_DeckPanel.prototype.__class__.remove = function() {
        return __ui_DeckPanel.prototype.remove.call.apply(__ui_DeckPanel.prototype.remove, arguments);
    };
    __ui_DeckPanel.prototype.__class__.remove.unbound_method = true;
    __ui_DeckPanel.prototype.remove.instance_method = true;
    __ui_DeckPanel.prototype.showWidget = function(index) {
    this.checkIndex(index);
    if ((this.visibleWidget != null)) {
    this.visibleWidget.setVisible(false);
    }
    this.visibleWidget = this.getWidget(index);
    this.visibleWidget.setVisible(true);
    };
    __ui_DeckPanel.prototype.__class__.showWidget = function() {
        return __ui_DeckPanel.prototype.showWidget.call.apply(__ui_DeckPanel.prototype.showWidget, arguments);
    };
    __ui_DeckPanel.prototype.__class__.showWidget.unbound_method = true;
    __ui_DeckPanel.prototype.showWidget.instance_method = true;
    __ui_DeckPanel.prototype.checkIndex = function(index) {
    if (((index < 0)) || ((index >= this.getWidgetCount()))) {
    }
    };
    __ui_DeckPanel.prototype.__class__.checkIndex = function() {
        return __ui_DeckPanel.prototype.checkIndex.call.apply(__ui_DeckPanel.prototype.checkIndex, arguments);
    };
    __ui_DeckPanel.prototype.__class__.checkIndex.unbound_method = true;
    __ui_DeckPanel.prototype.checkIndex.instance_method = true;
}
function __ui_SimplePanel() {
}
function ui_SimplePanel(element) {
    if (typeof element == 'undefined') element=null;
    var instance = new __ui_SimplePanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_SimplePanel.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
function __ui_SimplePanel_initialize() {
    if(__ui_SimplePanel.__was_initialized__) return;
    __ui_SimplePanel.__was_initialized__ = true;
    if(!__ui_Panel.__was_initialized__)
        __ui_Panel_initialize();
    pyjs_extend(__ui_SimplePanel, __ui_Panel);
    __ui_SimplePanel.prototype.__class__.__new__ = ui_SimplePanel;
    __ui_SimplePanel.prototype.__init__ = function(element) {
    if (typeof element == 'undefined') element=null;
    __ui_Panel.prototype.__class__.__init__(this);
    if ((element == null)) {
    var element = DOM_createDiv();
    }
    this.setElement(element);
    };
__ui_SimplePanel.prototype.__init__.parse_kwargs = function ( __kwargs, element ) {
    if (typeof element == 'undefined')
        element=__kwargs.element;
    var __r = [element];
    return __r;
};
    __ui_SimplePanel.prototype.__class__.__init__ = function() {
        return __ui_SimplePanel.prototype.__init__.call.apply(__ui_SimplePanel.prototype.__init__, arguments);
    };
    __ui_SimplePanel.prototype.__class__.__init__.unbound_method = true;
    __ui_SimplePanel.prototype.__init__.instance_method = true;
    __ui_SimplePanel.prototype.__class__.__init__.parse_kwargs = __ui_SimplePanel.prototype.__init__.parse_kwargs;
    __ui_SimplePanel.prototype.add = function(widget) {
    if ((this.getWidget() != null)) {
    console.error('SimplePanel can only contain one child widget');
    return;
    }
    this.setWidget(widget);
    };
    __ui_SimplePanel.prototype.__class__.add = function() {
        return __ui_SimplePanel.prototype.add.call.apply(__ui_SimplePanel.prototype.add, arguments);
    };
    __ui_SimplePanel.prototype.__class__.add.unbound_method = true;
    __ui_SimplePanel.prototype.add.instance_method = true;
    __ui_SimplePanel.prototype.getWidget = function() {
    if (pyjslib_len(this.children)) {
    return this.children.__getitem__(0);
    }
    return;
    };
    __ui_SimplePanel.prototype.__class__.getWidget = function() {
        return __ui_SimplePanel.prototype.getWidget.call.apply(__ui_SimplePanel.prototype.getWidget, arguments);
    };
    __ui_SimplePanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_SimplePanel.prototype.getWidget.instance_method = true;
    __ui_SimplePanel.prototype.remove = function(widget) {
    if ((this.getWidget() != widget)) {
    return false;
    }
    this.disown(widget);
    this.children.__delitem__(0);
    return true;
    };
    __ui_SimplePanel.prototype.__class__.remove = function() {
        return __ui_SimplePanel.prototype.remove.call.apply(__ui_SimplePanel.prototype.remove, arguments);
    };
    __ui_SimplePanel.prototype.__class__.remove.unbound_method = true;
    __ui_SimplePanel.prototype.remove.instance_method = true;
    __ui_SimplePanel.prototype.getContainerElement = function() {
    return this.getElement();
    };
    __ui_SimplePanel.prototype.__class__.getContainerElement = function() {
        return __ui_SimplePanel.prototype.getContainerElement.call.apply(__ui_SimplePanel.prototype.getContainerElement, arguments);
    };
    __ui_SimplePanel.prototype.__class__.getContainerElement.unbound_method = true;
    __ui_SimplePanel.prototype.getContainerElement.instance_method = true;
    __ui_SimplePanel.prototype.setWidget = function(widget) {
    if ((this.getWidget() == widget)) {
    return;
    }
    if ((this.getWidget() != null)) {
    this.remove(this.getWidget());
    }
    if ((widget != null)) {
    this.adopt(widget, this.getContainerElement());
    this.children.__setitem__(0, widget);
    }
    };
    __ui_SimplePanel.prototype.__class__.setWidget = function() {
        return __ui_SimplePanel.prototype.setWidget.call.apply(__ui_SimplePanel.prototype.setWidget, arguments);
    };
    __ui_SimplePanel.prototype.__class__.setWidget.unbound_method = true;
    __ui_SimplePanel.prototype.setWidget.instance_method = true;
}
function __ui_ScrollPanel() {
}
function ui_ScrollPanel(child) {
    if (typeof child == 'undefined') child=null;
    var instance = new __ui_ScrollPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_ScrollPanel.parse_kwargs = function ( __kwargs, child ) {
    if (typeof child == 'undefined')
        child=__kwargs.child;
    var __r = [child];
    return __r;
};
function __ui_ScrollPanel_initialize() {
    if(__ui_ScrollPanel.__was_initialized__) return;
    __ui_ScrollPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_ScrollPanel, __ui_SimplePanel);
    __ui_ScrollPanel.prototype.__class__.__new__ = ui_ScrollPanel;
    __ui_ScrollPanel.prototype.__init__ = function(child) {
    if (typeof child == 'undefined') child=null;
    __ui_SimplePanel.prototype.__class__.__init__(this);
    this.scrollListeners = new pyjslib_List([]);
    this.setAlwaysShowScrollBars(false);
    this.sinkEvents(__ui_Event.prototype.__class__.ONSCROLL);
    if ((child != null)) {
    this.setWidget(child);
    }
    };
__ui_ScrollPanel.prototype.__init__.parse_kwargs = function ( __kwargs, child ) {
    if (typeof child == 'undefined')
        child=__kwargs.child;
    var __r = [child];
    return __r;
};
    __ui_ScrollPanel.prototype.__class__.__init__ = function() {
        return __ui_ScrollPanel.prototype.__init__.call.apply(__ui_ScrollPanel.prototype.__init__, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_ScrollPanel.prototype.__init__.instance_method = true;
    __ui_ScrollPanel.prototype.__class__.__init__.parse_kwargs = __ui_ScrollPanel.prototype.__init__.parse_kwargs;
    __ui_ScrollPanel.prototype.addScrollListener = function(listener) {
    this.scrollListeners.append(listener);
    };
    __ui_ScrollPanel.prototype.__class__.addScrollListener = function() {
        return __ui_ScrollPanel.prototype.addScrollListener.call.apply(__ui_ScrollPanel.prototype.addScrollListener, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.addScrollListener.unbound_method = true;
    __ui_ScrollPanel.prototype.addScrollListener.instance_method = true;
    __ui_ScrollPanel.prototype.ensureVisible = function(item) {
    var scroll = this.getElement();
    var element = item.getElement();
    this.ensureVisibleImpl(scroll, element);
    };
    __ui_ScrollPanel.prototype.__class__.ensureVisible = function() {
        return __ui_ScrollPanel.prototype.ensureVisible.call.apply(__ui_ScrollPanel.prototype.ensureVisible, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.ensureVisible.unbound_method = true;
    __ui_ScrollPanel.prototype.ensureVisible.instance_method = true;
    __ui_ScrollPanel.prototype.getScrollPosition = function() {
    return DOM_getIntAttribute(this.getElement(), 'scrollTop');
    };
    __ui_ScrollPanel.prototype.__class__.getScrollPosition = function() {
        return __ui_ScrollPanel.prototype.getScrollPosition.call.apply(__ui_ScrollPanel.prototype.getScrollPosition, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.getScrollPosition.unbound_method = true;
    __ui_ScrollPanel.prototype.getScrollPosition.instance_method = true;
    __ui_ScrollPanel.prototype.getHorizontalScrollPosition = function() {
    return DOM_getIntAttribute(this.getElement(), 'scrollLeft');
    };
    __ui_ScrollPanel.prototype.__class__.getHorizontalScrollPosition = function() {
        return __ui_ScrollPanel.prototype.getHorizontalScrollPosition.call.apply(__ui_ScrollPanel.prototype.getHorizontalScrollPosition, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.getHorizontalScrollPosition.unbound_method = true;
    __ui_ScrollPanel.prototype.getHorizontalScrollPosition.instance_method = true;
    __ui_ScrollPanel.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'scroll')) {

        var __listener = this.scrollListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onScroll(this, this.getHorizontalScrollPosition(), this.getScrollPosition());

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_ScrollPanel.prototype.__class__.onBrowserEvent = function() {
        return __ui_ScrollPanel.prototype.onBrowserEvent.call.apply(__ui_ScrollPanel.prototype.onBrowserEvent, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_ScrollPanel.prototype.onBrowserEvent.instance_method = true;
    __ui_ScrollPanel.prototype.removeScrollListener = function(listener) {
    this.scrollListeners.remove(listener);
    };
    __ui_ScrollPanel.prototype.__class__.removeScrollListener = function() {
        return __ui_ScrollPanel.prototype.removeScrollListener.call.apply(__ui_ScrollPanel.prototype.removeScrollListener, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.removeScrollListener.unbound_method = true;
    __ui_ScrollPanel.prototype.removeScrollListener.instance_method = true;
    __ui_ScrollPanel.prototype.setAlwaysShowScrollBars = function(alwaysShow) {
    if (alwaysShow) {
    var style = 'scroll';
    }
    else {
    var style = 'auto';
    }
    DOM_setStyleAttribute(this.getElement(), 'overflow', style);
    };
    __ui_ScrollPanel.prototype.__class__.setAlwaysShowScrollBars = function() {
        return __ui_ScrollPanel.prototype.setAlwaysShowScrollBars.call.apply(__ui_ScrollPanel.prototype.setAlwaysShowScrollBars, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.setAlwaysShowScrollBars.unbound_method = true;
    __ui_ScrollPanel.prototype.setAlwaysShowScrollBars.instance_method = true;
    __ui_ScrollPanel.prototype.setScrollPosition = function(position) {
    DOM_setIntAttribute(this.getElement(), 'scrollTop', position);
    };
    __ui_ScrollPanel.prototype.__class__.setScrollPosition = function() {
        return __ui_ScrollPanel.prototype.setScrollPosition.call.apply(__ui_ScrollPanel.prototype.setScrollPosition, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.setScrollPosition.unbound_method = true;
    __ui_ScrollPanel.prototype.setScrollPosition.instance_method = true;
    __ui_ScrollPanel.prototype.setHorizontalScrollPosition = function(position) {
    DOM_setIntAttribute(this.getElement(), 'scrollLeft', position);
    };
    __ui_ScrollPanel.prototype.__class__.setHorizontalScrollPosition = function() {
        return __ui_ScrollPanel.prototype.setHorizontalScrollPosition.call.apply(__ui_ScrollPanel.prototype.setHorizontalScrollPosition, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.setHorizontalScrollPosition.unbound_method = true;
    __ui_ScrollPanel.prototype.setHorizontalScrollPosition.instance_method = true;
    __ui_ScrollPanel.prototype.ensureVisibleImpl = function(scroll, e) {

        if (!e) return;

        var item = e;
        var realOffset = 0;
        while (item && (item != scroll)) {
            realOffset += item.offsetTop;
            item = item.offsetParent;
            }

        scroll.scrollTop = realOffset - scroll.offsetHeight / 2;
        
    };
    __ui_ScrollPanel.prototype.__class__.ensureVisibleImpl = function() {
        return __ui_ScrollPanel.prototype.ensureVisibleImpl.call.apply(__ui_ScrollPanel.prototype.ensureVisibleImpl, arguments);
    };
    __ui_ScrollPanel.prototype.__class__.ensureVisibleImpl.unbound_method = true;
    __ui_ScrollPanel.prototype.ensureVisibleImpl.instance_method = true;
}
function __ui_PopupPanel() {
}
function ui_PopupPanel(autoHide, modal) {
    if (typeof autoHide == 'undefined') autoHide=false;
    if (typeof modal == 'undefined') modal=true;
    var instance = new __ui_PopupPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_PopupPanel.parse_kwargs = function ( __kwargs, autoHide, modal ) {
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    if (typeof modal == 'undefined')
        modal=__kwargs.modal;
    var __r = [autoHide, modal];
    return __r;
};
function __ui_PopupPanel_initialize() {
    if(__ui_PopupPanel.__was_initialized__) return;
    __ui_PopupPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_PopupPanel, __ui_SimplePanel);
    __ui_PopupPanel.prototype.__class__.__new__ = ui_PopupPanel;
    __ui_PopupPanel.prototype.__init__ = function(autoHide, modal) {
    if (typeof autoHide == 'undefined') autoHide=false;
    if (typeof modal == 'undefined') modal=true;
    this.popupListeners = new pyjslib_List([]);
    this.showing = false;
    this.autoHide = false;
    this.modal = modal;
    __ui_SimplePanel.prototype.__class__.__init__(this, this.createElement());
    DOM_setStyleAttribute(this.getElement(), 'position', 'absolute');
    if (autoHide) {
    this.autoHide = autoHide;
    }
    };
__ui_PopupPanel.prototype.__init__.parse_kwargs = function ( __kwargs, autoHide, modal ) {
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    if (typeof modal == 'undefined')
        modal=__kwargs.modal;
    var __r = [autoHide, modal];
    return __r;
};
    __ui_PopupPanel.prototype.__class__.__init__ = function() {
        return __ui_PopupPanel.prototype.__init__.call.apply(__ui_PopupPanel.prototype.__init__, arguments);
    };
    __ui_PopupPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_PopupPanel.prototype.__init__.instance_method = true;
    __ui_PopupPanel.prototype.__class__.__init__.parse_kwargs = __ui_PopupPanel.prototype.__init__.parse_kwargs;
    __ui_PopupPanel.prototype.addPopupListener = function(listener) {
    this.popupListeners.append(listener);
    };
    __ui_PopupPanel.prototype.__class__.addPopupListener = function() {
        return __ui_PopupPanel.prototype.addPopupListener.call.apply(__ui_PopupPanel.prototype.addPopupListener, arguments);
    };
    __ui_PopupPanel.prototype.__class__.addPopupListener.unbound_method = true;
    __ui_PopupPanel.prototype.addPopupListener.instance_method = true;
    __ui_PopupPanel.prototype.getPopupLeft = function() {
    return DOM_getIntAttribute(this.getElement(), 'offsetLeft');
    };
    __ui_PopupPanel.prototype.__class__.getPopupLeft = function() {
        return __ui_PopupPanel.prototype.getPopupLeft.call.apply(__ui_PopupPanel.prototype.getPopupLeft, arguments);
    };
    __ui_PopupPanel.prototype.__class__.getPopupLeft.unbound_method = true;
    __ui_PopupPanel.prototype.getPopupLeft.instance_method = true;
    __ui_PopupPanel.prototype.getPopupTop = function() {
    return DOM_getIntAttribute(this.getElement(), 'offsetTop');
    };
    __ui_PopupPanel.prototype.__class__.getPopupTop = function() {
        return __ui_PopupPanel.prototype.getPopupTop.call.apply(__ui_PopupPanel.prototype.getPopupTop, arguments);
    };
    __ui_PopupPanel.prototype.__class__.getPopupTop.unbound_method = true;
    __ui_PopupPanel.prototype.getPopupTop.instance_method = true;
    __ui_PopupPanel.prototype.createElement = function() {
    return DOM_createDiv();
    };
    __ui_PopupPanel.prototype.__class__.createElement = function() {
        return __ui_PopupPanel.prototype.createElement.call.apply(__ui_PopupPanel.prototype.createElement, arguments);
    };
    __ui_PopupPanel.prototype.__class__.createElement.unbound_method = true;
    __ui_PopupPanel.prototype.createElement.instance_method = true;
    __ui_PopupPanel.prototype.hide = function(autoClosed) {
    if (typeof autoClosed == 'undefined') autoClosed=false;
    if (!(this.showing)) {
    return;
    }
    this.showing = false;
    DOM_removeEventPreview(this);
    ui_RootPanel().get().remove(this);
    this.onHideImpl(this.getElement());

        var __listener = this.popupListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onPopupClosed) {
    listener.onPopupClosed(this, autoClosed);
    }
    else {
    listener(this, autoClosed);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
__ui_PopupPanel.prototype.hide.parse_kwargs = function ( __kwargs, autoClosed ) {
    if (typeof autoClosed == 'undefined')
        autoClosed=__kwargs.autoClosed;
    var __r = [autoClosed];
    return __r;
};
    __ui_PopupPanel.prototype.__class__.hide = function() {
        return __ui_PopupPanel.prototype.hide.call.apply(__ui_PopupPanel.prototype.hide, arguments);
    };
    __ui_PopupPanel.prototype.__class__.hide.unbound_method = true;
    __ui_PopupPanel.prototype.hide.instance_method = true;
    __ui_PopupPanel.prototype.__class__.hide.parse_kwargs = __ui_PopupPanel.prototype.hide.parse_kwargs;
    __ui_PopupPanel.prototype.isModal = function() {
    return this.modal;
    };
    __ui_PopupPanel.prototype.__class__.isModal = function() {
        return __ui_PopupPanel.prototype.isModal.call.apply(__ui_PopupPanel.prototype.isModal, arguments);
    };
    __ui_PopupPanel.prototype.__class__.isModal.unbound_method = true;
    __ui_PopupPanel.prototype.isModal.instance_method = true;
    __ui_PopupPanel.prototype.onEventPreview = function(event) {
    var target = DOM_eventGetTarget(event);
    var event_targets_popup = (target) && (DOM_isOrHasChild(this.getElement(), target));
    var type = DOM_eventGetType(event);
    if ((type == 'keydown')) {
    return (this.onKeyDownPreview(DOM_eventGetKeyCode(event), __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers(this, event))) && ((event_targets_popup) || (!(this.modal)));
    }
    else if ((type == 'keyup')) {
    return (this.onKeyUpPreview(DOM_eventGetKeyCode(event), __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers(this, event))) && ((event_targets_popup) || (!(this.modal)));
    }
    else if ((type == 'keypress')) {
    return (this.onKeyPressPreview(DOM_eventGetKeyCode(event), __ui_KeyboardListener.prototype.__class__.getKeyboardModifiers(this, event))) && ((event_targets_popup) || (!(this.modal)));
    }
    else if ((type == 'mousedown')) {
    if ((DOM_getCaptureElement() != null)) {
    return true;
    }
    if ((!(event_targets_popup)) && (this.autoHide)) {
    this.hide(true);
    return true;
    }
    }
    else if (((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'click')) || ((type == 'dblclick'))) {
    if ((DOM_getCaptureElement() != null)) {
    return true;
    }
    }
    return (!(this.modal)) || (event_targets_popup);
    };
    __ui_PopupPanel.prototype.__class__.onEventPreview = function() {
        return __ui_PopupPanel.prototype.onEventPreview.call.apply(__ui_PopupPanel.prototype.onEventPreview, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onEventPreview.unbound_method = true;
    __ui_PopupPanel.prototype.onEventPreview.instance_method = true;
    __ui_PopupPanel.prototype.onKeyDownPreview = function(key, modifiers) {
    return true;
    };
    __ui_PopupPanel.prototype.__class__.onKeyDownPreview = function() {
        return __ui_PopupPanel.prototype.onKeyDownPreview.call.apply(__ui_PopupPanel.prototype.onKeyDownPreview, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onKeyDownPreview.unbound_method = true;
    __ui_PopupPanel.prototype.onKeyDownPreview.instance_method = true;
    __ui_PopupPanel.prototype.onKeyPressPreview = function(key, modifiers) {
    return true;
    };
    __ui_PopupPanel.prototype.__class__.onKeyPressPreview = function() {
        return __ui_PopupPanel.prototype.onKeyPressPreview.call.apply(__ui_PopupPanel.prototype.onKeyPressPreview, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onKeyPressPreview.unbound_method = true;
    __ui_PopupPanel.prototype.onKeyPressPreview.instance_method = true;
    __ui_PopupPanel.prototype.onKeyUpPreview = function(key, modifiers) {
    return true;
    };
    __ui_PopupPanel.prototype.__class__.onKeyUpPreview = function() {
        return __ui_PopupPanel.prototype.onKeyUpPreview.call.apply(__ui_PopupPanel.prototype.onKeyUpPreview, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onKeyUpPreview.unbound_method = true;
    __ui_PopupPanel.prototype.onKeyUpPreview.instance_method = true;
    __ui_PopupPanel.prototype.onHideImpl = function(popup) {
    };
    __ui_PopupPanel.prototype.__class__.onHideImpl = function() {
        return __ui_PopupPanel.prototype.onHideImpl.call.apply(__ui_PopupPanel.prototype.onHideImpl, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onHideImpl.unbound_method = true;
    __ui_PopupPanel.prototype.onHideImpl.instance_method = true;
    __ui_PopupPanel.prototype.onShowImpl = function(popup) {
    };
    __ui_PopupPanel.prototype.__class__.onShowImpl = function() {
        return __ui_PopupPanel.prototype.onShowImpl.call.apply(__ui_PopupPanel.prototype.onShowImpl, arguments);
    };
    __ui_PopupPanel.prototype.__class__.onShowImpl.unbound_method = true;
    __ui_PopupPanel.prototype.onShowImpl.instance_method = true;
    __ui_PopupPanel.prototype.removePopupListener = function(listener) {
    this.popupListeners.remove(listener);
    };
    __ui_PopupPanel.prototype.__class__.removePopupListener = function() {
        return __ui_PopupPanel.prototype.removePopupListener.call.apply(__ui_PopupPanel.prototype.removePopupListener, arguments);
    };
    __ui_PopupPanel.prototype.__class__.removePopupListener.unbound_method = true;
    __ui_PopupPanel.prototype.removePopupListener.instance_method = true;
    __ui_PopupPanel.prototype.setPopupPosition = function(left, top) {
    if ((left < 0)) {
    var left = 0;
    }
    if ((top < 0)) {
    var top = 0;
    }
    var element = this.getElement();
    DOM_setStyleAttribute(element, 'left',  ( left + 'px' ) );
    DOM_setStyleAttribute(element, 'top',  ( top + 'px' ) );
    };
    __ui_PopupPanel.prototype.__class__.setPopupPosition = function() {
        return __ui_PopupPanel.prototype.setPopupPosition.call.apply(__ui_PopupPanel.prototype.setPopupPosition, arguments);
    };
    __ui_PopupPanel.prototype.__class__.setPopupPosition.unbound_method = true;
    __ui_PopupPanel.prototype.setPopupPosition.instance_method = true;
    __ui_PopupPanel.prototype.show = function() {
    if (this.showing) {
    return;
    }
    this.showing = true;
    DOM_addEventPreview(this);
    ui_RootPanel().get().add(this);
    this.onShowImpl(this.getElement());
    };
    __ui_PopupPanel.prototype.__class__.show = function() {
        return __ui_PopupPanel.prototype.show.call.apply(__ui_PopupPanel.prototype.show, arguments);
    };
    __ui_PopupPanel.prototype.__class__.show.unbound_method = true;
    __ui_PopupPanel.prototype.show.instance_method = true;
}
function __ui_MenuItem() {
}
function ui_MenuItem(text, asHTML, subMenu) {
    if (typeof subMenu == 'undefined') subMenu=null;
    var instance = new __ui_MenuItem();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_MenuItem.parse_kwargs = function ( __kwargs, text, asHTML, subMenu ) {
    if (typeof subMenu == 'undefined')
        subMenu=__kwargs.subMenu;
    var __r = [text, asHTML, subMenu];
    return __r;
};
function __ui_MenuItem_initialize() {
    if(__ui_MenuItem.__was_initialized__) return;
    __ui_MenuItem.__was_initialized__ = true;
    if(!__ui_UIObject.__was_initialized__)
        __ui_UIObject_initialize();
    pyjs_extend(__ui_MenuItem, __ui_UIObject);
    __ui_MenuItem.prototype.__class__.__new__ = ui_MenuItem;
    __ui_MenuItem.prototype.__init__ = function(text, asHTML, subMenu) {
    if (typeof subMenu == 'undefined') subMenu=null;
    var cmd = null;
    if ((subMenu == null)) {
    if (pyjslib_hasattr(asHTML, 'execute')) {
    var cmd = asHTML;
    var asHTML = false;
    }
    else if (pyjslib_hasattr(asHTML, 'onShow')) {
    var subMenu = asHTML;
    var asHTML = false;
    }
    }
    else if (pyjslib_hasattr(subMenu, 'execute')) {
    var cmd = subMenu;
    var subMenu = null;
    }
    this.command = null;
    this.parentMenu = null;
    this.subMenu = null;
    this.setElement(DOM_createTD());
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.ONMOUSEOVER | __ui_Event.prototype.__class__.ONMOUSEOUT));
    this.setSelectionStyle(false);
    if (asHTML) {
    this.setHTML(text);
    }
    else {
    this.setText(text);
    }
    this.setStyleName('gwt-MenuItem');
    if (cmd) {
    this.setCommand(cmd);
    }
    if (subMenu) {
    this.setSubMenu(subMenu);
    }
    };
__ui_MenuItem.prototype.__init__.parse_kwargs = function ( __kwargs, text, asHTML, subMenu ) {
    if (typeof subMenu == 'undefined')
        subMenu=__kwargs.subMenu;
    var __r = [text, asHTML, subMenu];
    return __r;
};
    __ui_MenuItem.prototype.__class__.__init__ = function() {
        return __ui_MenuItem.prototype.__init__.call.apply(__ui_MenuItem.prototype.__init__, arguments);
    };
    __ui_MenuItem.prototype.__class__.__init__.unbound_method = true;
    __ui_MenuItem.prototype.__init__.instance_method = true;
    __ui_MenuItem.prototype.__class__.__init__.parse_kwargs = __ui_MenuItem.prototype.__init__.parse_kwargs;
    __ui_MenuItem.prototype.getCommand = function() {
    return this.command;
    };
    __ui_MenuItem.prototype.__class__.getCommand = function() {
        return __ui_MenuItem.prototype.getCommand.call.apply(__ui_MenuItem.prototype.getCommand, arguments);
    };
    __ui_MenuItem.prototype.__class__.getCommand.unbound_method = true;
    __ui_MenuItem.prototype.getCommand.instance_method = true;
    __ui_MenuItem.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.getElement());
    };
    __ui_MenuItem.prototype.__class__.getHTML = function() {
        return __ui_MenuItem.prototype.getHTML.call.apply(__ui_MenuItem.prototype.getHTML, arguments);
    };
    __ui_MenuItem.prototype.__class__.getHTML.unbound_method = true;
    __ui_MenuItem.prototype.getHTML.instance_method = true;
    __ui_MenuItem.prototype.getParentMenu = function() {
    return this.parentMenu;
    };
    __ui_MenuItem.prototype.__class__.getParentMenu = function() {
        return __ui_MenuItem.prototype.getParentMenu.call.apply(__ui_MenuItem.prototype.getParentMenu, arguments);
    };
    __ui_MenuItem.prototype.__class__.getParentMenu.unbound_method = true;
    __ui_MenuItem.prototype.getParentMenu.instance_method = true;
    __ui_MenuItem.prototype.getSubMenu = function() {
    return this.subMenu;
    };
    __ui_MenuItem.prototype.__class__.getSubMenu = function() {
        return __ui_MenuItem.prototype.getSubMenu.call.apply(__ui_MenuItem.prototype.getSubMenu, arguments);
    };
    __ui_MenuItem.prototype.__class__.getSubMenu.unbound_method = true;
    __ui_MenuItem.prototype.getSubMenu.instance_method = true;
    __ui_MenuItem.prototype.getText = function() {
    return DOM_getInnerText(this.getElement());
    };
    __ui_MenuItem.prototype.__class__.getText = function() {
        return __ui_MenuItem.prototype.getText.call.apply(__ui_MenuItem.prototype.getText, arguments);
    };
    __ui_MenuItem.prototype.__class__.getText.unbound_method = true;
    __ui_MenuItem.prototype.getText.instance_method = true;
    __ui_MenuItem.prototype.setCommand = function(cmd) {
    this.command = cmd;
    };
    __ui_MenuItem.prototype.__class__.setCommand = function() {
        return __ui_MenuItem.prototype.setCommand.call.apply(__ui_MenuItem.prototype.setCommand, arguments);
    };
    __ui_MenuItem.prototype.__class__.setCommand.unbound_method = true;
    __ui_MenuItem.prototype.setCommand.instance_method = true;
    __ui_MenuItem.prototype.setHTML = function(html) {
    DOM_setInnerHTML(this.getElement(), html);
    };
    __ui_MenuItem.prototype.__class__.setHTML = function() {
        return __ui_MenuItem.prototype.setHTML.call.apply(__ui_MenuItem.prototype.setHTML, arguments);
    };
    __ui_MenuItem.prototype.__class__.setHTML.unbound_method = true;
    __ui_MenuItem.prototype.setHTML.instance_method = true;
    __ui_MenuItem.prototype.setSubMenu = function(subMenu) {
    this.subMenu = subMenu;
    };
    __ui_MenuItem.prototype.__class__.setSubMenu = function() {
        return __ui_MenuItem.prototype.setSubMenu.call.apply(__ui_MenuItem.prototype.setSubMenu, arguments);
    };
    __ui_MenuItem.prototype.__class__.setSubMenu.unbound_method = true;
    __ui_MenuItem.prototype.setSubMenu.instance_method = true;
    __ui_MenuItem.prototype.setText = function(text) {
    DOM_setInnerText(this.getElement(), text);
    };
    __ui_MenuItem.prototype.__class__.setText = function() {
        return __ui_MenuItem.prototype.setText.call.apply(__ui_MenuItem.prototype.setText, arguments);
    };
    __ui_MenuItem.prototype.__class__.setText.unbound_method = true;
    __ui_MenuItem.prototype.setText.instance_method = true;
    __ui_MenuItem.prototype.setParentMenu = function(parentMenu) {
    this.parentMenu = parentMenu;
    };
    __ui_MenuItem.prototype.__class__.setParentMenu = function() {
        return __ui_MenuItem.prototype.setParentMenu.call.apply(__ui_MenuItem.prototype.setParentMenu, arguments);
    };
    __ui_MenuItem.prototype.__class__.setParentMenu.unbound_method = true;
    __ui_MenuItem.prototype.setParentMenu.instance_method = true;
    __ui_MenuItem.prototype.setSelectionStyle = function(selected) {
    if (selected) {
    this.addStyleName('gwt-MenuItem-selected');
    }
    else {
    this.removeStyleName('gwt-MenuItem-selected');
    }
    };
    __ui_MenuItem.prototype.__class__.setSelectionStyle = function() {
        return __ui_MenuItem.prototype.setSelectionStyle.call.apply(__ui_MenuItem.prototype.setSelectionStyle, arguments);
    };
    __ui_MenuItem.prototype.__class__.setSelectionStyle.unbound_method = true;
    __ui_MenuItem.prototype.setSelectionStyle.instance_method = true;
}
function __ui_MenuBar() {
}
function ui_MenuBar(vertical) {
    if (typeof vertical == 'undefined') vertical=false;
    var instance = new __ui_MenuBar();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_MenuBar.parse_kwargs = function ( __kwargs, vertical ) {
    if (typeof vertical == 'undefined')
        vertical=__kwargs.vertical;
    var __r = [vertical];
    return __r;
};
function __ui_MenuBar_initialize() {
    if(__ui_MenuBar.__was_initialized__) return;
    __ui_MenuBar.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_MenuBar, __ui_Widget);
    __ui_MenuBar.prototype.__class__.__new__ = ui_MenuBar;
    __ui_MenuBar.prototype.__init__ = function(vertical) {
    if (typeof vertical == 'undefined') vertical=false;
    __ui_Widget.prototype.__class__.__init__(this);
    this.body = null;
    this.items = new pyjslib_List([]);
    this.parentMenu = null;
    this.popup = null;
    this.selectedItem = null;
    this.shownChildMenu = null;
    this.vertical = false;
    this.autoOpen = false;
    __ui_Widget.prototype.__class__.__init__(this);
    var table = DOM_createTable();
    this.body = DOM_createTBody();
    DOM_appendChild(table, this.body);
    if (!(vertical)) {
    var tr = DOM_createTR();
    DOM_appendChild(this.body, tr);
    }
    this.vertical = vertical;
    var outer = DOM_createDiv();
    DOM_appendChild(outer, table);
    this.setElement(outer);
    this.setStyleName('gwt-MenuBar');
    };
__ui_MenuBar.prototype.__init__.parse_kwargs = function ( __kwargs, vertical ) {
    if (typeof vertical == 'undefined')
        vertical=__kwargs.vertical;
    var __r = [vertical];
    return __r;
};
    __ui_MenuBar.prototype.__class__.__init__ = function() {
        return __ui_MenuBar.prototype.__init__.call.apply(__ui_MenuBar.prototype.__init__, arguments);
    };
    __ui_MenuBar.prototype.__class__.__init__.unbound_method = true;
    __ui_MenuBar.prototype.__init__.instance_method = true;
    __ui_MenuBar.prototype.__class__.__init__.parse_kwargs = __ui_MenuBar.prototype.__init__.parse_kwargs;
    __ui_MenuBar.prototype.addItem = function(item, asHTML, popup) {
    if (typeof asHTML == 'undefined') asHTML=null;
    if (typeof popup == 'undefined') popup=null;
    if (!(pyjslib_hasattr(item, 'setSubMenu'))) {
    var item = ui_MenuItem(item, asHTML, popup);
    }
    if (this.vertical) {
    var tr = DOM_createTR();
    DOM_appendChild(this.body, tr);
    }
    else {
    var tr = DOM_getChild(this.body, 0);
    }
    DOM_appendChild(tr, item.getElement());
    item.setParentMenu(this);
    item.setSelectionStyle(false);
    this.items.append(item);
    return item;
    };
__ui_MenuBar.prototype.addItem.parse_kwargs = function ( __kwargs, item, asHTML, popup ) {
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    if (typeof popup == 'undefined')
        popup=__kwargs.popup;
    var __r = [item, asHTML, popup];
    return __r;
};
    __ui_MenuBar.prototype.__class__.addItem = function() {
        return __ui_MenuBar.prototype.addItem.call.apply(__ui_MenuBar.prototype.addItem, arguments);
    };
    __ui_MenuBar.prototype.__class__.addItem.unbound_method = true;
    __ui_MenuBar.prototype.addItem.instance_method = true;
    __ui_MenuBar.prototype.__class__.addItem.parse_kwargs = __ui_MenuBar.prototype.addItem.parse_kwargs;
    __ui_MenuBar.prototype.clearItems = function() {
    var container = this.getItemContainerElement();
    while ((DOM_getChildCount(container) > 0)) {
    DOM_removeChild(container, DOM_getChild(container, 0));
    }
    this.items = new pyjslib_List([]);
    };
    __ui_MenuBar.prototype.__class__.clearItems = function() {
        return __ui_MenuBar.prototype.clearItems.call.apply(__ui_MenuBar.prototype.clearItems, arguments);
    };
    __ui_MenuBar.prototype.__class__.clearItems.unbound_method = true;
    __ui_MenuBar.prototype.clearItems.instance_method = true;
    __ui_MenuBar.prototype.getAutoOpen = function() {
    return this.autoOpen;
    };
    __ui_MenuBar.prototype.__class__.getAutoOpen = function() {
        return __ui_MenuBar.prototype.getAutoOpen.call.apply(__ui_MenuBar.prototype.getAutoOpen, arguments);
    };
    __ui_MenuBar.prototype.__class__.getAutoOpen.unbound_method = true;
    __ui_MenuBar.prototype.getAutoOpen.instance_method = true;
    __ui_MenuBar.prototype.onBrowserEvent = function(event) {
    __ui_Widget.prototype.__class__.onBrowserEvent(this, event);
    var item = this.findItem(DOM_eventGetTarget(event));
    if ((item == null)) {
    return;
    }
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    this.doItemAction(item, true);
    }
    else if ((type == 'mouseover')) {
    this.itemOver(item);
    }
    else if ((type == 'mouseout')) {
    this.itemOver(null);
    }
    };
    __ui_MenuBar.prototype.__class__.onBrowserEvent = function() {
        return __ui_MenuBar.prototype.onBrowserEvent.call.apply(__ui_MenuBar.prototype.onBrowserEvent, arguments);
    };
    __ui_MenuBar.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_MenuBar.prototype.onBrowserEvent.instance_method = true;
    __ui_MenuBar.prototype.onPopupClosed = function(sender, autoClosed) {
    if (autoClosed) {
    this.closeAllParents();
    }
    this.onHide();
    this.shownChildMenu = null;
    this.popup = null;
    };
    __ui_MenuBar.prototype.__class__.onPopupClosed = function() {
        return __ui_MenuBar.prototype.onPopupClosed.call.apply(__ui_MenuBar.prototype.onPopupClosed, arguments);
    };
    __ui_MenuBar.prototype.__class__.onPopupClosed.unbound_method = true;
    __ui_MenuBar.prototype.onPopupClosed.instance_method = true;
    __ui_MenuBar.prototype.removeItem = function(item) {
    var idx = this.items.index(item);
    if ((idx == -1)) {
    return;
    }
    var container = this.getItemContainerElement();
    DOM_removeChild(container, DOM_getChild(container, idx));
    this.items.__delitem__(idx);
    };
    __ui_MenuBar.prototype.__class__.removeItem = function() {
        return __ui_MenuBar.prototype.removeItem.call.apply(__ui_MenuBar.prototype.removeItem, arguments);
    };
    __ui_MenuBar.prototype.__class__.removeItem.unbound_method = true;
    __ui_MenuBar.prototype.removeItem.instance_method = true;
    __ui_MenuBar.prototype.setAutoOpen = function(autoOpen) {
    this.autoOpen = autoOpen;
    };
    __ui_MenuBar.prototype.__class__.setAutoOpen = function() {
        return __ui_MenuBar.prototype.setAutoOpen.call.apply(__ui_MenuBar.prototype.setAutoOpen, arguments);
    };
    __ui_MenuBar.prototype.__class__.setAutoOpen.unbound_method = true;
    __ui_MenuBar.prototype.setAutoOpen.instance_method = true;
    __ui_MenuBar.prototype.closeAllParents = function() {
    var curMenu = this;
    while ((curMenu != null)) {
    curMenu.close();
    if (((curMenu.parentMenu == null)) && ((curMenu.selectedItem != null))) {
    curMenu.selectedItem.setSelectionStyle(false);
    curMenu.selectedItem = null;
    }
    var curMenu = curMenu.parentMenu;
    }
    };
    __ui_MenuBar.prototype.__class__.closeAllParents = function() {
        return __ui_MenuBar.prototype.closeAllParents.call.apply(__ui_MenuBar.prototype.closeAllParents, arguments);
    };
    __ui_MenuBar.prototype.__class__.closeAllParents.unbound_method = true;
    __ui_MenuBar.prototype.closeAllParents.instance_method = true;
    __ui_MenuBar.prototype.doItemAction = function(item, fireCommand) {
    if (((this.shownChildMenu != null)) && ((item.getSubMenu() == this.shownChildMenu))) {
    return;
    }
    if ((this.shownChildMenu != null)) {
    this.shownChildMenu.onHide();
    this.popup.hide();
    }
    if ((item.getSubMenu() == null)) {
    if (fireCommand) {
    this.closeAllParents();
    var cmd = item.getCommand();
    if ((cmd != null)) {
    DeferredCommand_DeferredCommand().add(cmd);
    }
    }
    return;
    }
    this.selectItem(item);
    this.popup = ui_MenuBarPopupPanel(item);
    this.popup.addPopupListener(this);
    if (this.vertical) {
    this.popup.setPopupPosition( ( item.getAbsoluteLeft() + item.getOffsetWidth() ) , item.getAbsoluteTop());
    }
    else {
    this.popup.setPopupPosition(item.getAbsoluteLeft(),  ( item.getAbsoluteTop() + item.getOffsetHeight() ) );
    }
    this.shownChildMenu = item.getSubMenu();
    var sub_menu = item.getSubMenu();
    sub_menu.parentMenu = this;
    this.popup.show();
    };
    __ui_MenuBar.prototype.__class__.doItemAction = function() {
        return __ui_MenuBar.prototype.doItemAction.call.apply(__ui_MenuBar.prototype.doItemAction, arguments);
    };
    __ui_MenuBar.prototype.__class__.doItemAction.unbound_method = true;
    __ui_MenuBar.prototype.doItemAction.instance_method = true;
    __ui_MenuBar.prototype.onDetach = function() {
    if ((this.popup != null)) {
    this.popup.hide();
    }
    __ui_Widget.prototype.__class__.onDetach(this);
    };
    __ui_MenuBar.prototype.__class__.onDetach = function() {
        return __ui_MenuBar.prototype.onDetach.call.apply(__ui_MenuBar.prototype.onDetach, arguments);
    };
    __ui_MenuBar.prototype.__class__.onDetach.unbound_method = true;
    __ui_MenuBar.prototype.onDetach.instance_method = true;
    __ui_MenuBar.prototype.itemOver = function(item) {
    if ((item == null)) {
    if (((this.selectedItem != null)) && ((this.shownChildMenu == this.selectedItem.getSubMenu()))) {
    return;
    }
    }
    this.selectItem(item);
    if ((item != null)) {
    if (((this.shownChildMenu != null)) || ((this.parentMenu != null)) || (this.autoOpen)) {
    this.doItemAction(item, false);
    }
    }
    };
    __ui_MenuBar.prototype.__class__.itemOver = function() {
        return __ui_MenuBar.prototype.itemOver.call.apply(__ui_MenuBar.prototype.itemOver, arguments);
    };
    __ui_MenuBar.prototype.__class__.itemOver.unbound_method = true;
    __ui_MenuBar.prototype.itemOver.instance_method = true;
    __ui_MenuBar.prototype.close = function() {
    if ((this.parentMenu != null)) {
    this.parentMenu.popup.hide();
    }
    };
    __ui_MenuBar.prototype.__class__.close = function() {
        return __ui_MenuBar.prototype.close.call.apply(__ui_MenuBar.prototype.close, arguments);
    };
    __ui_MenuBar.prototype.__class__.close.unbound_method = true;
    __ui_MenuBar.prototype.close.instance_method = true;
    __ui_MenuBar.prototype.findItem = function(hItem) {

        var __item = this.items.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    if (DOM_isOrHasChild(item.getElement(), hItem)) {
    return item;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return;
    };
    __ui_MenuBar.prototype.__class__.findItem = function() {
        return __ui_MenuBar.prototype.findItem.call.apply(__ui_MenuBar.prototype.findItem, arguments);
    };
    __ui_MenuBar.prototype.__class__.findItem.unbound_method = true;
    __ui_MenuBar.prototype.findItem.instance_method = true;
    __ui_MenuBar.prototype.getItemContainerElement = function() {
    if (this.vertical) {
    return this.body;
    }
    else {
    return DOM_getChild(this.body, 0);
    }
    };
    __ui_MenuBar.prototype.__class__.getItemContainerElement = function() {
        return __ui_MenuBar.prototype.getItemContainerElement.call.apply(__ui_MenuBar.prototype.getItemContainerElement, arguments);
    };
    __ui_MenuBar.prototype.__class__.getItemContainerElement.unbound_method = true;
    __ui_MenuBar.prototype.getItemContainerElement.instance_method = true;
    __ui_MenuBar.prototype.onHide = function() {
    if ((this.shownChildMenu != null)) {
    this.shownChildMenu.onHide();
    this.popup.hide();
    }
    };
    __ui_MenuBar.prototype.__class__.onHide = function() {
        return __ui_MenuBar.prototype.onHide.call.apply(__ui_MenuBar.prototype.onHide, arguments);
    };
    __ui_MenuBar.prototype.__class__.onHide.unbound_method = true;
    __ui_MenuBar.prototype.onHide.instance_method = true;
    __ui_MenuBar.prototype.onShow = function() {
    if ((pyjslib_len(this.items) > 0)) {
    this.selectItem(this.items.__getitem__(0));
    }
    };
    __ui_MenuBar.prototype.__class__.onShow = function() {
        return __ui_MenuBar.prototype.onShow.call.apply(__ui_MenuBar.prototype.onShow, arguments);
    };
    __ui_MenuBar.prototype.__class__.onShow.unbound_method = true;
    __ui_MenuBar.prototype.onShow.instance_method = true;
    __ui_MenuBar.prototype.selectItem = function(item) {
    if ((item == this.selectedItem)) {
    return;
    }
    if ((this.selectedItem != null)) {
    this.selectedItem.setSelectionStyle(false);
    }
    if ((item != null)) {
    item.setSelectionStyle(true);
    }
    this.selectedItem = item;
    };
    __ui_MenuBar.prototype.__class__.selectItem = function() {
        return __ui_MenuBar.prototype.selectItem.call.apply(__ui_MenuBar.prototype.selectItem, arguments);
    };
    __ui_MenuBar.prototype.__class__.selectItem.unbound_method = true;
    __ui_MenuBar.prototype.selectItem.instance_method = true;
}
function __ui_MenuBarPopupPanel() {
}
function ui_MenuBarPopupPanel(item) {
    var instance = new __ui_MenuBarPopupPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_MenuBarPopupPanel_initialize() {
    if(__ui_MenuBarPopupPanel.__was_initialized__) return;
    __ui_MenuBarPopupPanel.__was_initialized__ = true;
    if(!__ui_PopupPanel.__was_initialized__)
        __ui_PopupPanel_initialize();
    pyjs_extend(__ui_MenuBarPopupPanel, __ui_PopupPanel);
    __ui_MenuBarPopupPanel.prototype.__class__.__new__ = ui_MenuBarPopupPanel;
    __ui_MenuBarPopupPanel.prototype.__init__ = function(item) {
    this.item = item;
    __ui_PopupPanel.prototype.__class__.__init__(this, true);
    this.setWidget(item.getSubMenu());
    item.getSubMenu().onShow();
    };
    __ui_MenuBarPopupPanel.prototype.__class__.__init__ = function() {
        return __ui_MenuBarPopupPanel.prototype.__init__.call.apply(__ui_MenuBarPopupPanel.prototype.__init__, arguments);
    };
    __ui_MenuBarPopupPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_MenuBarPopupPanel.prototype.__init__.instance_method = true;
    __ui_MenuBarPopupPanel.prototype.onEventPreview = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    var target = DOM_eventGetTarget(event);
    var parentMenuElement = this.item.getParentMenu().getElement();
    if (DOM_isOrHasChild(parentMenuElement, target)) {
    return false;
    }
    }
    return __ui_PopupPanel.prototype.__class__.onEventPreview(this, event);
    };
    __ui_MenuBarPopupPanel.prototype.__class__.onEventPreview = function() {
        return __ui_MenuBarPopupPanel.prototype.onEventPreview.call.apply(__ui_MenuBarPopupPanel.prototype.onEventPreview, arguments);
    };
    __ui_MenuBarPopupPanel.prototype.__class__.onEventPreview.unbound_method = true;
    __ui_MenuBarPopupPanel.prototype.onEventPreview.instance_method = true;
}
function __ui_ListBox() {
}
function ui_ListBox() {
    var instance = new __ui_ListBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ListBox_initialize() {
    if(__ui_ListBox.__was_initialized__) return;
    __ui_ListBox.__was_initialized__ = true;
    if(!__ui_FocusWidget.__was_initialized__)
        __ui_FocusWidget_initialize();
    pyjs_extend(__ui_ListBox, __ui_FocusWidget);
    __ui_ListBox.prototype.__class__.__new__ = ui_ListBox;
    __ui_ListBox.prototype.__init__ = function() {
    this.changeListeners = new pyjslib_List([]);
    this.INSERT_AT_END = -1;
    __ui_FocusWidget.prototype.__class__.__init__(this, DOM_createSelect());
    this.sinkEvents(__ui_Event.prototype.__class__.ONCHANGE);
    this.setStyleName('gwt-ListBox');
    };
    __ui_ListBox.prototype.__class__.__init__ = function() {
        return __ui_ListBox.prototype.__init__.call.apply(__ui_ListBox.prototype.__init__, arguments);
    };
    __ui_ListBox.prototype.__class__.__init__.unbound_method = true;
    __ui_ListBox.prototype.__init__.instance_method = true;
    __ui_ListBox.prototype.addChangeListener = function(listener) {
    this.changeListeners.append(listener);
    };
    __ui_ListBox.prototype.__class__.addChangeListener = function() {
        return __ui_ListBox.prototype.addChangeListener.call.apply(__ui_ListBox.prototype.addChangeListener, arguments);
    };
    __ui_ListBox.prototype.__class__.addChangeListener.unbound_method = true;
    __ui_ListBox.prototype.addChangeListener.instance_method = true;
    __ui_ListBox.prototype.addItem = function(item, value) {
    if (typeof value == 'undefined') value=null;
    this.insertItem(item, value, this.INSERT_AT_END);
    };
__ui_ListBox.prototype.addItem.parse_kwargs = function ( __kwargs, item, value ) {
    if (typeof value == 'undefined')
        value=__kwargs.value;
    var __r = [item, value];
    return __r;
};
    __ui_ListBox.prototype.__class__.addItem = function() {
        return __ui_ListBox.prototype.addItem.call.apply(__ui_ListBox.prototype.addItem, arguments);
    };
    __ui_ListBox.prototype.__class__.addItem.unbound_method = true;
    __ui_ListBox.prototype.addItem.instance_method = true;
    __ui_ListBox.prototype.__class__.addItem.parse_kwargs = __ui_ListBox.prototype.addItem.parse_kwargs;
    __ui_ListBox.prototype.clear = function() {
    var h = this.getElement();
    while ((DOM_getChildCount(h) > 0)) {
    DOM_removeChild(h, DOM_getChild(h, 0));
    }
    };
    __ui_ListBox.prototype.__class__.clear = function() {
        return __ui_ListBox.prototype.clear.call.apply(__ui_ListBox.prototype.clear, arguments);
    };
    __ui_ListBox.prototype.__class__.clear.unbound_method = true;
    __ui_ListBox.prototype.clear.instance_method = true;
    __ui_ListBox.prototype.getItemCount = function() {
    return DOM_getChildCount(this.getElement());
    };
    __ui_ListBox.prototype.__class__.getItemCount = function() {
        return __ui_ListBox.prototype.getItemCount.call.apply(__ui_ListBox.prototype.getItemCount, arguments);
    };
    __ui_ListBox.prototype.__class__.getItemCount.unbound_method = true;
    __ui_ListBox.prototype.getItemCount.instance_method = true;
    __ui_ListBox.prototype.getItemText = function(index) {
    var child = DOM_getChild(this.getElement(), index);
    return DOM_getInnerText(child);
    };
    __ui_ListBox.prototype.__class__.getItemText = function() {
        return __ui_ListBox.prototype.getItemText.call.apply(__ui_ListBox.prototype.getItemText, arguments);
    };
    __ui_ListBox.prototype.__class__.getItemText.unbound_method = true;
    __ui_ListBox.prototype.getItemText.instance_method = true;
    __ui_ListBox.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_ListBox.prototype.__class__.getName = function() {
        return __ui_ListBox.prototype.getName.call.apply(__ui_ListBox.prototype.getName, arguments);
    };
    __ui_ListBox.prototype.__class__.getName.unbound_method = true;
    __ui_ListBox.prototype.getName.instance_method = true;
    __ui_ListBox.prototype.getSelectedIndex = function() {
    return DOM_getIntAttribute(this.getElement(), 'selectedIndex');
    };
    __ui_ListBox.prototype.__class__.getSelectedIndex = function() {
        return __ui_ListBox.prototype.getSelectedIndex.call.apply(__ui_ListBox.prototype.getSelectedIndex, arguments);
    };
    __ui_ListBox.prototype.__class__.getSelectedIndex.unbound_method = true;
    __ui_ListBox.prototype.getSelectedIndex.instance_method = true;
    __ui_ListBox.prototype.getValue = function(index) {
    this.checkIndex(index);
    var option = DOM_getChild(this.getElement(), index);
    return DOM_getAttribute(option, 'value');
    };
    __ui_ListBox.prototype.__class__.getValue = function() {
        return __ui_ListBox.prototype.getValue.call.apply(__ui_ListBox.prototype.getValue, arguments);
    };
    __ui_ListBox.prototype.__class__.getValue.unbound_method = true;
    __ui_ListBox.prototype.getValue.instance_method = true;
    __ui_ListBox.prototype.getVisibleItemCount = function() {
    return DOM_getIntAttribute(this.getElement(), 'size');
    };
    __ui_ListBox.prototype.__class__.getVisibleItemCount = function() {
        return __ui_ListBox.prototype.getVisibleItemCount.call.apply(__ui_ListBox.prototype.getVisibleItemCount, arguments);
    };
    __ui_ListBox.prototype.__class__.getVisibleItemCount.unbound_method = true;
    __ui_ListBox.prototype.getVisibleItemCount.instance_method = true;
    __ui_ListBox.prototype.insertItem = function(item, value, index) {
    if (typeof index == 'undefined') index=null;
    if ((index == null)) {
    var index = value;
    var value = null;
    }
    DOM_insertListItem(this.getElement(), item, value, index);
    };
__ui_ListBox.prototype.insertItem.parse_kwargs = function ( __kwargs, item, value, index ) {
    if (typeof index == 'undefined')
        index=__kwargs.index;
    var __r = [item, value, index];
    return __r;
};
    __ui_ListBox.prototype.__class__.insertItem = function() {
        return __ui_ListBox.prototype.insertItem.call.apply(__ui_ListBox.prototype.insertItem, arguments);
    };
    __ui_ListBox.prototype.__class__.insertItem.unbound_method = true;
    __ui_ListBox.prototype.insertItem.instance_method = true;
    __ui_ListBox.prototype.__class__.insertItem.parse_kwargs = __ui_ListBox.prototype.insertItem.parse_kwargs;
    __ui_ListBox.prototype.isItemSelected = function(index) {
    this.checkIndex(index);
    var option = DOM_getChild(this.getElement(), index);
    return DOM_getBooleanAttribute(option, 'selected');
    };
    __ui_ListBox.prototype.__class__.isItemSelected = function() {
        return __ui_ListBox.prototype.isItemSelected.call.apply(__ui_ListBox.prototype.isItemSelected, arguments);
    };
    __ui_ListBox.prototype.__class__.isItemSelected.unbound_method = true;
    __ui_ListBox.prototype.isItemSelected.instance_method = true;
    __ui_ListBox.prototype.isMultipleSelect = function() {
    return DOM_getBooleanAttribute(this.getElement(), 'multiple');
    };
    __ui_ListBox.prototype.__class__.isMultipleSelect = function() {
        return __ui_ListBox.prototype.isMultipleSelect.call.apply(__ui_ListBox.prototype.isMultipleSelect, arguments);
    };
    __ui_ListBox.prototype.__class__.isMultipleSelect.unbound_method = true;
    __ui_ListBox.prototype.isMultipleSelect.instance_method = true;
    __ui_ListBox.prototype.onBrowserEvent = function(event) {
    if ((DOM_eventGetType(event) == 'change')) {

        var __listener = this.changeListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onChange) {
    listener.onChange(this);
    }
    else {
    listener(this);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else {
    __ui_FocusWidget.prototype.__class__.onBrowserEvent(this, event);
    }
    };
    __ui_ListBox.prototype.__class__.onBrowserEvent = function() {
        return __ui_ListBox.prototype.onBrowserEvent.call.apply(__ui_ListBox.prototype.onBrowserEvent, arguments);
    };
    __ui_ListBox.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_ListBox.prototype.onBrowserEvent.instance_method = true;
    __ui_ListBox.prototype.removeChangeListener = function(listener) {
    this.changeListeners.remove(listener);
    };
    __ui_ListBox.prototype.__class__.removeChangeListener = function() {
        return __ui_ListBox.prototype.removeChangeListener.call.apply(__ui_ListBox.prototype.removeChangeListener, arguments);
    };
    __ui_ListBox.prototype.__class__.removeChangeListener.unbound_method = true;
    __ui_ListBox.prototype.removeChangeListener.instance_method = true;
    __ui_ListBox.prototype.removeItem = function(idx) {
    var child = DOM_getChild(this.getElement(), idx);
    DOM_removeChild(this.getElement(), child);
    };
    __ui_ListBox.prototype.__class__.removeItem = function() {
        return __ui_ListBox.prototype.removeItem.call.apply(__ui_ListBox.prototype.removeItem, arguments);
    };
    __ui_ListBox.prototype.__class__.removeItem.unbound_method = true;
    __ui_ListBox.prototype.removeItem.instance_method = true;
    __ui_ListBox.prototype.setItemSelected = function(index, selected) {
    this.checkIndex(index);
    var option = DOM_getChild(this.getElement(), index);
    DOM_setBooleanAttribute(option, 'selected', selected);
    };
    __ui_ListBox.prototype.__class__.setItemSelected = function() {
        return __ui_ListBox.prototype.setItemSelected.call.apply(__ui_ListBox.prototype.setItemSelected, arguments);
    };
    __ui_ListBox.prototype.__class__.setItemSelected.unbound_method = true;
    __ui_ListBox.prototype.setItemSelected.instance_method = true;
    __ui_ListBox.prototype.setMultipleSelect = function(multiple) {
    DOM_setBooleanAttribute(this.getElement(), 'multiple', multiple);
    };
    __ui_ListBox.prototype.__class__.setMultipleSelect = function() {
        return __ui_ListBox.prototype.setMultipleSelect.call.apply(__ui_ListBox.prototype.setMultipleSelect, arguments);
    };
    __ui_ListBox.prototype.__class__.setMultipleSelect.unbound_method = true;
    __ui_ListBox.prototype.setMultipleSelect.instance_method = true;
    __ui_ListBox.prototype.setName = function(name) {
    DOM_setAttribute(this.getElement(), 'name', name);
    };
    __ui_ListBox.prototype.__class__.setName = function() {
        return __ui_ListBox.prototype.setName.call.apply(__ui_ListBox.prototype.setName, arguments);
    };
    __ui_ListBox.prototype.__class__.setName.unbound_method = true;
    __ui_ListBox.prototype.setName.instance_method = true;
    __ui_ListBox.prototype.setSelectedIndex = function(index) {
    DOM_setIntAttribute(this.getElement(), 'selectedIndex', index);
    };
    __ui_ListBox.prototype.__class__.setSelectedIndex = function() {
        return __ui_ListBox.prototype.setSelectedIndex.call.apply(__ui_ListBox.prototype.setSelectedIndex, arguments);
    };
    __ui_ListBox.prototype.__class__.setSelectedIndex.unbound_method = true;
    __ui_ListBox.prototype.setSelectedIndex.instance_method = true;
    __ui_ListBox.prototype.selectValue = function(value) {

        var __n = pyjslib_range(this.getItemCount()).__iter__();
        try {
            while (true) {
                var n = __n.next();
                
        
    if ((this.getItemText(n) == value)) {
    this.setSelectedIndex(n);
    return n;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return;
    };
    __ui_ListBox.prototype.__class__.selectValue = function() {
        return __ui_ListBox.prototype.selectValue.call.apply(__ui_ListBox.prototype.selectValue, arguments);
    };
    __ui_ListBox.prototype.__class__.selectValue.unbound_method = true;
    __ui_ListBox.prototype.selectValue.instance_method = true;
    __ui_ListBox.prototype.setItemText = function(index, text) {
    this.checkIndex(index);
    if ((text == null)) {
    console.error('Cannot set an option to have null text');
    return;
    }
    DOM_setOptionText(this.getElement(), text, index);
    };
    __ui_ListBox.prototype.__class__.setItemText = function() {
        return __ui_ListBox.prototype.setItemText.call.apply(__ui_ListBox.prototype.setItemText, arguments);
    };
    __ui_ListBox.prototype.__class__.setItemText.unbound_method = true;
    __ui_ListBox.prototype.setItemText.instance_method = true;
    __ui_ListBox.prototype.setValue = function(index, value) {
    this.checkIndex(index);
    var option = DOM_getChild(this.getElement(), index);
    DOM_setAttribute(option, 'value', value);
    };
    __ui_ListBox.prototype.__class__.setValue = function() {
        return __ui_ListBox.prototype.setValue.call.apply(__ui_ListBox.prototype.setValue, arguments);
    };
    __ui_ListBox.prototype.__class__.setValue.unbound_method = true;
    __ui_ListBox.prototype.setValue.instance_method = true;
    __ui_ListBox.prototype.setVisibleItemCount = function(visibleItems) {
    DOM_setIntAttribute(this.getElement(), 'size', visibleItems);
    };
    __ui_ListBox.prototype.__class__.setVisibleItemCount = function() {
        return __ui_ListBox.prototype.setVisibleItemCount.call.apply(__ui_ListBox.prototype.setVisibleItemCount, arguments);
    };
    __ui_ListBox.prototype.__class__.setVisibleItemCount.unbound_method = true;
    __ui_ListBox.prototype.setVisibleItemCount.instance_method = true;
    __ui_ListBox.prototype.checkIndex = function(index) {
    var elem = this.getElement();
    if (((index < 0)) || ((index >= DOM_getChildCount(elem)))) {
    }
    };
    __ui_ListBox.prototype.__class__.checkIndex = function() {
        return __ui_ListBox.prototype.checkIndex.call.apply(__ui_ListBox.prototype.checkIndex, arguments);
    };
    __ui_ListBox.prototype.__class__.checkIndex.unbound_method = true;
    __ui_ListBox.prototype.checkIndex.instance_method = true;
}
function __ui_DialogBox() {
}
function ui_DialogBox(autoHide, modal) {
    if (typeof autoHide == 'undefined') autoHide=null;
    if (typeof modal == 'undefined') modal=true;
    var instance = new __ui_DialogBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_DialogBox.parse_kwargs = function ( __kwargs, autoHide, modal ) {
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    if (typeof modal == 'undefined')
        modal=__kwargs.modal;
    var __r = [autoHide, modal];
    return __r;
};
function __ui_DialogBox_initialize() {
    if(__ui_DialogBox.__was_initialized__) return;
    __ui_DialogBox.__was_initialized__ = true;
    if(!__ui_PopupPanel.__was_initialized__)
        __ui_PopupPanel_initialize();
    pyjs_extend(__ui_DialogBox, __ui_PopupPanel);
    __ui_DialogBox.prototype.__class__.__new__ = ui_DialogBox;
    __ui_DialogBox.prototype.__init__ = function(autoHide, modal) {
    if (typeof autoHide == 'undefined') autoHide=null;
    if (typeof modal == 'undefined') modal=true;
    __ui_PopupPanel.prototype.__class__.__init__(this, autoHide, modal);
    this.caption = ui_HTML();
    this.child = null;
    this.dragging = false;
    this.dragStartX = 0;
    this.dragStartY = 0;
    this.panel = ui_FlexTable();
    this.panel.setWidget(0, 0, this.caption);
    this.panel.setHeight('100%');
    this.panel.setBorderWidth(0);
    this.panel.setCellPadding(0);
    this.panel.setCellSpacing(0);
    this.panel.getCellFormatter().setHeight(1, 0, '100%');
    this.panel.getCellFormatter().setWidth(1, 0, '100%');
    this.panel.getCellFormatter().setAlignment(1, 0, __ui_HasHorizontalAlignment.prototype.__class__.ALIGN_CENTER, __ui_HasVerticalAlignment.prototype.__class__.ALIGN_MIDDLE);
    __ui_PopupPanel.prototype.__class__.setWidget(this, this.panel);
    this.setStyleName('gwt-DialogBox');
    this.caption.setStyleName('Caption');
    this.caption.addMouseListener(this);
    };
__ui_DialogBox.prototype.__init__.parse_kwargs = function ( __kwargs, autoHide, modal ) {
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    if (typeof modal == 'undefined')
        modal=__kwargs.modal;
    var __r = [autoHide, modal];
    return __r;
};
    __ui_DialogBox.prototype.__class__.__init__ = function() {
        return __ui_DialogBox.prototype.__init__.call.apply(__ui_DialogBox.prototype.__init__, arguments);
    };
    __ui_DialogBox.prototype.__class__.__init__.unbound_method = true;
    __ui_DialogBox.prototype.__init__.instance_method = true;
    __ui_DialogBox.prototype.__class__.__init__.parse_kwargs = __ui_DialogBox.prototype.__init__.parse_kwargs;
    __ui_DialogBox.prototype.getHTML = function() {
    return this.caption.getHTML();
    };
    __ui_DialogBox.prototype.__class__.getHTML = function() {
        return __ui_DialogBox.prototype.getHTML.call.apply(__ui_DialogBox.prototype.getHTML, arguments);
    };
    __ui_DialogBox.prototype.__class__.getHTML.unbound_method = true;
    __ui_DialogBox.prototype.getHTML.instance_method = true;
    __ui_DialogBox.prototype.getText = function() {
    return this.caption.getText();
    };
    __ui_DialogBox.prototype.__class__.getText = function() {
        return __ui_DialogBox.prototype.getText.call.apply(__ui_DialogBox.prototype.getText, arguments);
    };
    __ui_DialogBox.prototype.__class__.getText.unbound_method = true;
    __ui_DialogBox.prototype.getText.instance_method = true;
    __ui_DialogBox.prototype.onEventPreview = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'mousedown')) {
    var target = DOM_eventGetTarget(event);
    var elem = this.caption.getElement();
    var event_targets_popup = (target) && (DOM_isOrHasChild(elem, target));
    if (event_targets_popup) {
    DOM_eventPreventDefault(event);
    }
    }
    return __ui_PopupPanel.prototype.__class__.onEventPreview(this, event);
    };
    __ui_DialogBox.prototype.__class__.onEventPreview = function() {
        return __ui_DialogBox.prototype.onEventPreview.call.apply(__ui_DialogBox.prototype.onEventPreview, arguments);
    };
    __ui_DialogBox.prototype.__class__.onEventPreview.unbound_method = true;
    __ui_DialogBox.prototype.onEventPreview.instance_method = true;
    __ui_DialogBox.prototype.onMouseDown = function(sender, x, y) {
    this.dragging = true;
    DOM_setCapture(this.caption.getElement());
    this.dragStartX = x;
    this.dragStartY = y;
    };
    __ui_DialogBox.prototype.__class__.onMouseDown = function() {
        return __ui_DialogBox.prototype.onMouseDown.call.apply(__ui_DialogBox.prototype.onMouseDown, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseDown.unbound_method = true;
    __ui_DialogBox.prototype.onMouseDown.instance_method = true;
    __ui_DialogBox.prototype.onMouseEnter = function(sender) {
    };
    __ui_DialogBox.prototype.__class__.onMouseEnter = function() {
        return __ui_DialogBox.prototype.onMouseEnter.call.apply(__ui_DialogBox.prototype.onMouseEnter, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseEnter.unbound_method = true;
    __ui_DialogBox.prototype.onMouseEnter.instance_method = true;
    __ui_DialogBox.prototype.onMouseLeave = function(sender) {
    };
    __ui_DialogBox.prototype.__class__.onMouseLeave = function() {
        return __ui_DialogBox.prototype.onMouseLeave.call.apply(__ui_DialogBox.prototype.onMouseLeave, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseLeave.unbound_method = true;
    __ui_DialogBox.prototype.onMouseLeave.instance_method = true;
    __ui_DialogBox.prototype.onMouseMove = function(sender, x, y) {
    if (this.dragging) {
    var absX =  ( x + this.getAbsoluteLeft() ) ;
    var absY =  ( y + this.getAbsoluteTop() ) ;
    this.setPopupPosition( ( absX - this.dragStartX ) ,  ( absY - this.dragStartY ) );
    }
    };
    __ui_DialogBox.prototype.__class__.onMouseMove = function() {
        return __ui_DialogBox.prototype.onMouseMove.call.apply(__ui_DialogBox.prototype.onMouseMove, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseMove.unbound_method = true;
    __ui_DialogBox.prototype.onMouseMove.instance_method = true;
    __ui_DialogBox.prototype.onMouseUp = function(sender, x, y) {
    this.dragging = false;
    DOM_releaseCapture(this.caption.getElement());
    };
    __ui_DialogBox.prototype.__class__.onMouseUp = function() {
        return __ui_DialogBox.prototype.onMouseUp.call.apply(__ui_DialogBox.prototype.onMouseUp, arguments);
    };
    __ui_DialogBox.prototype.__class__.onMouseUp.unbound_method = true;
    __ui_DialogBox.prototype.onMouseUp.instance_method = true;
    __ui_DialogBox.prototype.remove = function(widget) {
    if ((this.child != widget)) {
    return false;
    }
    this.panel.remove(widget);
    return true;
    };
    __ui_DialogBox.prototype.__class__.remove = function() {
        return __ui_DialogBox.prototype.remove.call.apply(__ui_DialogBox.prototype.remove, arguments);
    };
    __ui_DialogBox.prototype.__class__.remove.unbound_method = true;
    __ui_DialogBox.prototype.remove.instance_method = true;
    __ui_DialogBox.prototype.setHTML = function(html) {
    this.caption.setHTML(html);
    };
    __ui_DialogBox.prototype.__class__.setHTML = function() {
        return __ui_DialogBox.prototype.setHTML.call.apply(__ui_DialogBox.prototype.setHTML, arguments);
    };
    __ui_DialogBox.prototype.__class__.setHTML.unbound_method = true;
    __ui_DialogBox.prototype.setHTML.instance_method = true;
    __ui_DialogBox.prototype.setText = function(text) {
    this.caption.setText(text);
    };
    __ui_DialogBox.prototype.__class__.setText = function() {
        return __ui_DialogBox.prototype.setText.call.apply(__ui_DialogBox.prototype.setText, arguments);
    };
    __ui_DialogBox.prototype.__class__.setText.unbound_method = true;
    __ui_DialogBox.prototype.setText.instance_method = true;
    __ui_DialogBox.prototype.doAttachChildren = function() {
    __ui_PopupPanel.prototype.__class__.doAttachChildren(this);
    this.caption.onAttach();
    };
    __ui_DialogBox.prototype.__class__.doAttachChildren = function() {
        return __ui_DialogBox.prototype.doAttachChildren.call.apply(__ui_DialogBox.prototype.doAttachChildren, arguments);
    };
    __ui_DialogBox.prototype.__class__.doAttachChildren.unbound_method = true;
    __ui_DialogBox.prototype.doAttachChildren.instance_method = true;
    __ui_DialogBox.prototype.doDetachChildren = function() {
    __ui_PopupPanel.prototype.__class__.doDetachChildren(this);
    this.caption.onDetach();
    };
    __ui_DialogBox.prototype.__class__.doDetachChildren = function() {
        return __ui_DialogBox.prototype.doDetachChildren.call.apply(__ui_DialogBox.prototype.doDetachChildren, arguments);
    };
    __ui_DialogBox.prototype.__class__.doDetachChildren.unbound_method = true;
    __ui_DialogBox.prototype.doDetachChildren.instance_method = true;
    __ui_DialogBox.prototype.setWidget = function(widget) {
    if ((this.child != null)) {
    this.panel.remove(this.child);
    }
    if ((widget != null)) {
    this.panel.setWidget(1, 0, widget);
    }
    this.child = widget;
    };
    __ui_DialogBox.prototype.__class__.setWidget = function() {
        return __ui_DialogBox.prototype.setWidget.call.apply(__ui_DialogBox.prototype.setWidget, arguments);
    };
    __ui_DialogBox.prototype.__class__.setWidget.unbound_method = true;
    __ui_DialogBox.prototype.setWidget.instance_method = true;
}
function __ui_Frame() {
}
function ui_Frame(url) {
    if (typeof url == 'undefined') url='';
    var instance = new __ui_Frame();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Frame.parse_kwargs = function ( __kwargs, url ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    var __r = [url];
    return __r;
};
function __ui_Frame_initialize() {
    if(__ui_Frame.__was_initialized__) return;
    __ui_Frame.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Frame, __ui_Widget);
    __ui_Frame.prototype.__class__.__new__ = ui_Frame;
    __ui_Frame.prototype.__init__ = function(url) {
    if (typeof url == 'undefined') url='';
    __ui_Widget.prototype.__class__.__init__(this);
    this.setElement(DOM_createIFrame());
    if (url) {
    this.setUrl(url);
    }
    };
__ui_Frame.prototype.__init__.parse_kwargs = function ( __kwargs, url ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    var __r = [url];
    return __r;
};
    __ui_Frame.prototype.__class__.__init__ = function() {
        return __ui_Frame.prototype.__init__.call.apply(__ui_Frame.prototype.__init__, arguments);
    };
    __ui_Frame.prototype.__class__.__init__.unbound_method = true;
    __ui_Frame.prototype.__init__.instance_method = true;
    __ui_Frame.prototype.__class__.__init__.parse_kwargs = __ui_Frame.prototype.__init__.parse_kwargs;
    __ui_Frame.prototype.getUrl = function() {
    return DOM_getAttribute(this.getElement(), 'src');
    };
    __ui_Frame.prototype.__class__.getUrl = function() {
        return __ui_Frame.prototype.getUrl.call.apply(__ui_Frame.prototype.getUrl, arguments);
    };
    __ui_Frame.prototype.__class__.getUrl.unbound_method = true;
    __ui_Frame.prototype.getUrl.instance_method = true;
    __ui_Frame.prototype.setUrl = function(url) {
    return DOM_setAttribute(this.getElement(), 'src', url);
    };
    __ui_Frame.prototype.__class__.setUrl = function() {
        return __ui_Frame.prototype.setUrl.call.apply(__ui_Frame.prototype.setUrl, arguments);
    };
    __ui_Frame.prototype.__class__.setUrl.unbound_method = true;
    __ui_Frame.prototype.setUrl.instance_method = true;
}
function __ui_ClickDelegatePanel() {
}
function ui_ClickDelegatePanel(p, child, cDelegate, kDelegate) {
    var instance = new __ui_ClickDelegatePanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ClickDelegatePanel_initialize() {
    if(__ui_ClickDelegatePanel.__was_initialized__) return;
    __ui_ClickDelegatePanel.__was_initialized__ = true;
    if(!__ui_Composite.__was_initialized__)
        __ui_Composite_initialize();
    pyjs_extend(__ui_ClickDelegatePanel, __ui_Composite);
    __ui_ClickDelegatePanel.prototype.__class__.__new__ = ui_ClickDelegatePanel;
    __ui_ClickDelegatePanel.prototype.__init__ = function(p, child, cDelegate, kDelegate) {
    __ui_Composite.prototype.__class__.__init__(this);
    this.clickDelegate = cDelegate;
    this.keyDelegate = kDelegate;
    this.focusablePanel = ui_SimplePanel(ui_Focus().createFocusable());
    this.focusablePanel.setWidget(child);
    var wrapperWidget = p.createTabTextWrapper();
    if ((wrapperWidget == null)) {
    this.initWidget(this.focusablePanel);
    }
    else {
    wrapperWidget.setWidget(this.focusablePanel);
    this.initWidget(wrapperWidget);
    }
    child.addClickListener(this);
    if (pyjslib_hasattr(child, 'addKeyboardListener')) {
    child.addKeyboardListener(kDelegate);
    }
    this.sinkEvents((__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.ONKEYDOWN));
    };
    __ui_ClickDelegatePanel.prototype.__class__.__init__ = function() {
        return __ui_ClickDelegatePanel.prototype.__init__.call.apply(__ui_ClickDelegatePanel.prototype.__init__, arguments);
    };
    __ui_ClickDelegatePanel.prototype.__class__.__init__.unbound_method = true;
    __ui_ClickDelegatePanel.prototype.__init__.instance_method = true;
    __ui_ClickDelegatePanel.prototype.onClick = function(sender, event) {
    this.clickDelegate.onClick(this, event);
    };
    __ui_ClickDelegatePanel.prototype.__class__.onClick = function() {
        return __ui_ClickDelegatePanel.prototype.onClick.call.apply(__ui_ClickDelegatePanel.prototype.onClick, arguments);
    };
    __ui_ClickDelegatePanel.prototype.__class__.onClick.unbound_method = true;
    __ui_ClickDelegatePanel.prototype.onClick.instance_method = true;
    __ui_ClickDelegatePanel.prototype.getFocusablePanel = function() {
    return this.focusablePanel;
    };
    __ui_ClickDelegatePanel.prototype.__class__.getFocusablePanel = function() {
        return __ui_ClickDelegatePanel.prototype.getFocusablePanel.call.apply(__ui_ClickDelegatePanel.prototype.getFocusablePanel, arguments);
    };
    __ui_ClickDelegatePanel.prototype.__class__.getFocusablePanel.unbound_method = true;
    __ui_ClickDelegatePanel.prototype.getFocusablePanel.instance_method = true;
    __ui_ClickDelegatePanel.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    this.onClick(this, event);
    }
    else if ((type == 'keydown')) {
    var modifiers = ui_KeyboardListener().getKeyboardModifiers(event);
    if (pyjslib_hasattr(this.keyDelegate, 'onKeyDown')) {
    this.keyDelegate.onKeyDown(this, DOM_eventGetKeyCode(event), modifiers);
    }
    }
    };
    __ui_ClickDelegatePanel.prototype.__class__.onBrowserEvent = function() {
        return __ui_ClickDelegatePanel.prototype.onBrowserEvent.call.apply(__ui_ClickDelegatePanel.prototype.onBrowserEvent, arguments);
    };
    __ui_ClickDelegatePanel.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_ClickDelegatePanel.prototype.onBrowserEvent.instance_method = true;
}
function __ui_TabBar() {
}
function ui_TabBar() {
    var instance = new __ui_TabBar();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TabBar_initialize() {
    if(__ui_TabBar.__was_initialized__) return;
    __ui_TabBar.__was_initialized__ = true;
    if(!__ui_Composite.__was_initialized__)
        __ui_Composite_initialize();
    pyjs_extend(__ui_TabBar, __ui_Composite);
    __ui_TabBar.prototype.__class__.__new__ = ui_TabBar;
    __ui_TabBar.prototype.__class__.STYLENAME_DEFAULT = 'gwt-TabBarItem';
    __ui_TabBar.prototype.__init__ = function() {
    __ui_Composite.prototype.__class__.__init__(this);
    this.panel = ui_HorizontalPanel();
    this.selectedTab = null;
    this.tabListeners = new pyjslib_List([]);
    this.initWidget(this.panel);
    this.sinkEvents(__ui_Event.prototype.__class__.ONCLICK);
    this.setStyleName('gwt-TabBar');
    this.panel.setVerticalAlignment(__ui_HasAlignment.prototype.__class__.ALIGN_BOTTOM);
    var first = ui_HTML('&nbsp;', true);
    var rest = ui_HTML('&nbsp;', true);
    first.setStyleName('gwt-TabBarFirst');
    rest.setStyleName('gwt-TabBarRest');
    first.setHeight('100%');
    rest.setHeight('100%');
    this.panel.add(first);
    this.panel.add(rest);
    first.setHeight('100%');
    this.panel.setCellHeight(first, '100%');
    this.panel.setCellWidth(rest, '100%');
    };
    __ui_TabBar.prototype.__class__.__init__ = function() {
        return __ui_TabBar.prototype.__init__.call.apply(__ui_TabBar.prototype.__init__, arguments);
    };
    __ui_TabBar.prototype.__class__.__init__.unbound_method = true;
    __ui_TabBar.prototype.__init__.instance_method = true;
    __ui_TabBar.prototype.addTab = function(text, asHTML) {
    if (typeof asHTML == 'undefined') asHTML=false;
    this.insertTab(text, asHTML, this.getTabCount());
    };
__ui_TabBar.prototype.addTab.parse_kwargs = function ( __kwargs, text, asHTML ) {
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [text, asHTML];
    return __r;
};
    __ui_TabBar.prototype.__class__.addTab = function() {
        return __ui_TabBar.prototype.addTab.call.apply(__ui_TabBar.prototype.addTab, arguments);
    };
    __ui_TabBar.prototype.__class__.addTab.unbound_method = true;
    __ui_TabBar.prototype.addTab.instance_method = true;
    __ui_TabBar.prototype.__class__.addTab.parse_kwargs = __ui_TabBar.prototype.addTab.parse_kwargs;
    __ui_TabBar.prototype.addTabListener = function(listener) {
    this.tabListeners.append(listener);
    };
    __ui_TabBar.prototype.__class__.addTabListener = function() {
        return __ui_TabBar.prototype.addTabListener.call.apply(__ui_TabBar.prototype.addTabListener, arguments);
    };
    __ui_TabBar.prototype.__class__.addTabListener.unbound_method = true;
    __ui_TabBar.prototype.addTabListener.instance_method = true;
    __ui_TabBar.prototype.getSelectedTab = function() {
    if ((this.selectedTab == null)) {
    return -1;
    }
    return  ( this.panel.getWidgetIndex(this.selectedTab) - 1 ) ;
    };
    __ui_TabBar.prototype.__class__.getSelectedTab = function() {
        return __ui_TabBar.prototype.getSelectedTab.call.apply(__ui_TabBar.prototype.getSelectedTab, arguments);
    };
    __ui_TabBar.prototype.__class__.getSelectedTab.unbound_method = true;
    __ui_TabBar.prototype.getSelectedTab.instance_method = true;
    __ui_TabBar.prototype.getTabCount = function() {
    return  ( this.panel.getWidgetCount() - 2 ) ;
    };
    __ui_TabBar.prototype.__class__.getTabCount = function() {
        return __ui_TabBar.prototype.getTabCount.call.apply(__ui_TabBar.prototype.getTabCount, arguments);
    };
    __ui_TabBar.prototype.__class__.getTabCount.unbound_method = true;
    __ui_TabBar.prototype.getTabCount.instance_method = true;
    __ui_TabBar.prototype.getTabHTML = function(index) {
    if ((index >= this.getTabCount())) {
    return;
    }
    var delPanel = this.panel.getWidget( ( index + 1 ) );
    var focusablePanel = delPanel.getFocusablePanel();
    var widget = focusablePanel.getWidget();
    if (pyjslib_hasattr(widget, 'getHTML')) {
    return widget.getHTML();
    }
    else if (pyjslib_hasattr(widget, 'getText')) {
    return widget.getText();
    }
    else {
    var fpe = DOM_getParent(this.focusablePanel.getElement());
    return DOM_getInnerHTML(fpe);
    }
    };
    __ui_TabBar.prototype.__class__.getTabHTML = function() {
        return __ui_TabBar.prototype.getTabHTML.call.apply(__ui_TabBar.prototype.getTabHTML, arguments);
    };
    __ui_TabBar.prototype.__class__.getTabHTML.unbound_method = true;
    __ui_TabBar.prototype.getTabHTML.instance_method = true;
    __ui_TabBar.prototype.createTabTextWrapper = function() {
    return;
    };
    __ui_TabBar.prototype.__class__.createTabTextWrapper = function() {
        return __ui_TabBar.prototype.createTabTextWrapper.call.apply(__ui_TabBar.prototype.createTabTextWrapper, arguments);
    };
    __ui_TabBar.prototype.__class__.createTabTextWrapper.unbound_method = true;
    __ui_TabBar.prototype.createTabTextWrapper.instance_method = true;
    __ui_TabBar.prototype.insertTab = function(text, asHTML, beforeIndex) {
    if (typeof beforeIndex == 'undefined') beforeIndex=null;
    if ((beforeIndex == null)) {
    var beforeIndex = asHTML;
    var asHTML = false;
    }
    if (((beforeIndex < 0)) || ((beforeIndex > this.getTabCount()))) {
    }
    if (pyjslib_isString(text)) {
    if (asHTML) {
    var item = ui_HTML(text);
    }
    else {
    var item = ui_Label(text);
    }
    item.setWordWrap(false);
    }
    else {
    var item = text;
    }
    this.insertTabWidget(item, beforeIndex);
    };
__ui_TabBar.prototype.insertTab.parse_kwargs = function ( __kwargs, text, asHTML, beforeIndex ) {
    if (typeof beforeIndex == 'undefined')
        beforeIndex=__kwargs.beforeIndex;
    var __r = [text, asHTML, beforeIndex];
    return __r;
};
    __ui_TabBar.prototype.__class__.insertTab = function() {
        return __ui_TabBar.prototype.insertTab.call.apply(__ui_TabBar.prototype.insertTab, arguments);
    };
    __ui_TabBar.prototype.__class__.insertTab.unbound_method = true;
    __ui_TabBar.prototype.insertTab.instance_method = true;
    __ui_TabBar.prototype.__class__.insertTab.parse_kwargs = __ui_TabBar.prototype.insertTab.parse_kwargs;
    __ui_TabBar.prototype.insertTabWidget = function(widget, beforeIndex) {
    var delWidget = ui_ClickDelegatePanel(this, widget, this, this);
    delWidget.setStyleName(this.STYLENAME_DEFAULT);
    var focusablePanel = delWidget.getFocusablePanel();
    this.panel.insert(delWidget,  ( beforeIndex + 1 ) );
    this.setStyleName(DOM_getParent(delWidget.getElement()),  ( this.STYLENAME_DEFAULT + '-wrapper' ) , true);
    };
    __ui_TabBar.prototype.__class__.insertTabWidget = function() {
        return __ui_TabBar.prototype.insertTabWidget.call.apply(__ui_TabBar.prototype.insertTabWidget, arguments);
    };
    __ui_TabBar.prototype.__class__.insertTabWidget.unbound_method = true;
    __ui_TabBar.prototype.insertTabWidget.instance_method = true;
    __ui_TabBar.prototype.onClick = function(sender) {

        var __i = pyjslib_range(1,  ( this.panel.getWidgetCount() - 1 ) ).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    if ((this.panel.getWidget(i) == sender)) {
    return this.selectTab( ( i - 1 ) );
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return false;
    };
    __ui_TabBar.prototype.__class__.onClick = function() {
        return __ui_TabBar.prototype.onClick.call.apply(__ui_TabBar.prototype.onClick, arguments);
    };
    __ui_TabBar.prototype.__class__.onClick.unbound_method = true;
    __ui_TabBar.prototype.onClick.instance_method = true;
    __ui_TabBar.prototype.removeTab = function(index) {
    this.checkTabIndex(index);
    var toRemove = this.panel.getWidget( ( index + 1 ) );
    if ((toRemove == this.selectedTab)) {
    this.selectedTab = null;
    }
    this.panel.remove(toRemove);
    };
    __ui_TabBar.prototype.__class__.removeTab = function() {
        return __ui_TabBar.prototype.removeTab.call.apply(__ui_TabBar.prototype.removeTab, arguments);
    };
    __ui_TabBar.prototype.__class__.removeTab.unbound_method = true;
    __ui_TabBar.prototype.removeTab.instance_method = true;
    __ui_TabBar.prototype.removeTabListener = function(listener) {
    this.tabListeners.remove(listener);
    };
    __ui_TabBar.prototype.__class__.removeTabListener = function() {
        return __ui_TabBar.prototype.removeTabListener.call.apply(__ui_TabBar.prototype.removeTabListener, arguments);
    };
    __ui_TabBar.prototype.__class__.removeTabListener.unbound_method = true;
    __ui_TabBar.prototype.removeTabListener.instance_method = true;
    __ui_TabBar.prototype.selectTab = function(index) {
    this.checkTabIndex(index);

        var __listener = this.tabListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (!(listener.onBeforeTabSelected(this, index))) {
    return false;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    this.setSelectionStyle(this.selectedTab, false);
    if ((index == -1)) {
    this.selectedTab = null;
    return true;
    }
    this.selectedTab = this.panel.getWidget( ( index + 1 ) );
    this.setSelectionStyle(this.selectedTab, true);

        var __listener = this.tabListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onTabSelected(this, index);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return true;
    };
    __ui_TabBar.prototype.__class__.selectTab = function() {
        return __ui_TabBar.prototype.selectTab.call.apply(__ui_TabBar.prototype.selectTab, arguments);
    };
    __ui_TabBar.prototype.__class__.selectTab.unbound_method = true;
    __ui_TabBar.prototype.selectTab.instance_method = true;
    __ui_TabBar.prototype.checkTabIndex = function(index) {
    if (((index < -1)) || ((index >= this.getTabCount()))) {
    }
    };
    __ui_TabBar.prototype.__class__.checkTabIndex = function() {
        return __ui_TabBar.prototype.checkTabIndex.call.apply(__ui_TabBar.prototype.checkTabIndex, arguments);
    };
    __ui_TabBar.prototype.__class__.checkTabIndex.unbound_method = true;
    __ui_TabBar.prototype.checkTabIndex.instance_method = true;
    __ui_TabBar.prototype.setSelectionStyle = function(item, selected) {
    if ((item != null)) {
    if (selected) {
    item.addStyleName('gwt-TabBarItem-selected');
    this.setStyleName(DOM_getParent(item.getElement()), 'gwt-TabBarItem-wrapper-selected', true);
    }
    else {
    item.removeStyleName('gwt-TabBarItem-selected');
    this.setStyleName(DOM_getParent(item.getElement()), 'gwt-TabBarItem-wrapper-selected', false);
    }
    }
    };
    __ui_TabBar.prototype.__class__.setSelectionStyle = function() {
        return __ui_TabBar.prototype.setSelectionStyle.call.apply(__ui_TabBar.prototype.setSelectionStyle, arguments);
    };
    __ui_TabBar.prototype.__class__.setSelectionStyle.unbound_method = true;
    __ui_TabBar.prototype.setSelectionStyle.instance_method = true;
}
function __ui_TabPanel() {
}
function ui_TabPanel(tabBar) {
    if (typeof tabBar == 'undefined') tabBar=null;
    var instance = new __ui_TabPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_TabPanel.parse_kwargs = function ( __kwargs, tabBar ) {
    if (typeof tabBar == 'undefined')
        tabBar=__kwargs.tabBar;
    var __r = [tabBar];
    return __r;
};
function __ui_TabPanel_initialize() {
    if(__ui_TabPanel.__was_initialized__) return;
    __ui_TabPanel.__was_initialized__ = true;
    if(!__ui_Composite.__was_initialized__)
        __ui_Composite_initialize();
    pyjs_extend(__ui_TabPanel, __ui_Composite);
    __ui_TabPanel.prototype.__class__.__new__ = ui_TabPanel;
    __ui_TabPanel.prototype.__init__ = function(tabBar) {
    if (typeof tabBar == 'undefined') tabBar=null;
    __ui_Composite.prototype.__class__.__init__(this);
    this.tab_children = new pyjslib_List([]);
    this.deck = ui_DeckPanel();
    if ((tabBar == null)) {
    this.tabBar = ui_TabBar();
    }
    else {
    this.tabBar = tabBar;
    }
    this.tabListeners = new pyjslib_List([]);
    var panel = ui_VerticalPanel();
    panel.add(this.tabBar);
    panel.add(this.deck);
    panel.setCellHeight(this.deck, '100%');
    this.tabBar.setWidth('100%');
    this.tabBar.addTabListener(this);
    this.initWidget(panel);
    this.setStyleName('gwt-TabPanel');
    this.deck.setStyleName('gwt-TabPanelBottom');
    };
__ui_TabPanel.prototype.__init__.parse_kwargs = function ( __kwargs, tabBar ) {
    if (typeof tabBar == 'undefined')
        tabBar=__kwargs.tabBar;
    var __r = [tabBar];
    return __r;
};
    __ui_TabPanel.prototype.__class__.__init__ = function() {
        return __ui_TabPanel.prototype.__init__.call.apply(__ui_TabPanel.prototype.__init__, arguments);
    };
    __ui_TabPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_TabPanel.prototype.__init__.instance_method = true;
    __ui_TabPanel.prototype.__class__.__init__.parse_kwargs = __ui_TabPanel.prototype.__init__.parse_kwargs;
    __ui_TabPanel.prototype.add = function(widget, tabText, asHTML) {
    if (typeof tabText == 'undefined') tabText=null;
    if (typeof asHTML == 'undefined') asHTML=false;
    if ((tabText == null)) {
    console.error('A tabText parameter must be specified with add().');
    }
    this.insert(widget, tabText, asHTML, this.getWidgetCount());
    };
__ui_TabPanel.prototype.add.parse_kwargs = function ( __kwargs, widget, tabText, asHTML ) {
    if (typeof tabText == 'undefined')
        tabText=__kwargs.tabText;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [widget, tabText, asHTML];
    return __r;
};
    __ui_TabPanel.prototype.__class__.add = function() {
        return __ui_TabPanel.prototype.add.call.apply(__ui_TabPanel.prototype.add, arguments);
    };
    __ui_TabPanel.prototype.__class__.add.unbound_method = true;
    __ui_TabPanel.prototype.add.instance_method = true;
    __ui_TabPanel.prototype.__class__.add.parse_kwargs = __ui_TabPanel.prototype.add.parse_kwargs;
    __ui_TabPanel.prototype.addTabListener = function(listener) {
    this.tabListeners.append(listener);
    };
    __ui_TabPanel.prototype.__class__.addTabListener = function() {
        return __ui_TabPanel.prototype.addTabListener.call.apply(__ui_TabPanel.prototype.addTabListener, arguments);
    };
    __ui_TabPanel.prototype.__class__.addTabListener.unbound_method = true;
    __ui_TabPanel.prototype.addTabListener.instance_method = true;
    __ui_TabPanel.prototype.clear = function() {
    while ((this.getWidgetCount() > 0)) {
    this.remove(this.getWidget(0));
    }
    };
    __ui_TabPanel.prototype.__class__.clear = function() {
        return __ui_TabPanel.prototype.clear.call.apply(__ui_TabPanel.prototype.clear, arguments);
    };
    __ui_TabPanel.prototype.__class__.clear.unbound_method = true;
    __ui_TabPanel.prototype.clear.instance_method = true;
    __ui_TabPanel.prototype.getDeckPanel = function() {
    return this.deck;
    };
    __ui_TabPanel.prototype.__class__.getDeckPanel = function() {
        return __ui_TabPanel.prototype.getDeckPanel.call.apply(__ui_TabPanel.prototype.getDeckPanel, arguments);
    };
    __ui_TabPanel.prototype.__class__.getDeckPanel.unbound_method = true;
    __ui_TabPanel.prototype.getDeckPanel.instance_method = true;
    __ui_TabPanel.prototype.getTabBar = function() {
    return this.tabBar;
    };
    __ui_TabPanel.prototype.__class__.getTabBar = function() {
        return __ui_TabPanel.prototype.getTabBar.call.apply(__ui_TabPanel.prototype.getTabBar, arguments);
    };
    __ui_TabPanel.prototype.__class__.getTabBar.unbound_method = true;
    __ui_TabPanel.prototype.getTabBar.instance_method = true;
    __ui_TabPanel.prototype.getWidget = function(index) {
    return this.tab_children.__getitem__(index);
    };
    __ui_TabPanel.prototype.__class__.getWidget = function() {
        return __ui_TabPanel.prototype.getWidget.call.apply(__ui_TabPanel.prototype.getWidget, arguments);
    };
    __ui_TabPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_TabPanel.prototype.getWidget.instance_method = true;
    __ui_TabPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.tab_children);
    };
    __ui_TabPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_TabPanel.prototype.getWidgetCount.call.apply(__ui_TabPanel.prototype.getWidgetCount, arguments);
    };
    __ui_TabPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_TabPanel.prototype.getWidgetCount.instance_method = true;
    __ui_TabPanel.prototype.getWidgetIndex = function(child) {
    return this.tab_children.index(child);
    };
    __ui_TabPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_TabPanel.prototype.getWidgetIndex.call.apply(__ui_TabPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_TabPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_TabPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_TabPanel.prototype.insert = function(widget, tabText, asHTML, beforeIndex) {
    if (typeof beforeIndex == 'undefined') beforeIndex=null;
    if ((beforeIndex == null)) {
    var beforeIndex = asHTML;
    var asHTML = false;
    }
    this.tab_children.insert(beforeIndex, widget);
    this.tabBar.insertTab(tabText, asHTML, beforeIndex);
    this.deck.insert(widget, beforeIndex);
    };
__ui_TabPanel.prototype.insert.parse_kwargs = function ( __kwargs, widget, tabText, asHTML, beforeIndex ) {
    if (typeof beforeIndex == 'undefined')
        beforeIndex=__kwargs.beforeIndex;
    var __r = [widget, tabText, asHTML, beforeIndex];
    return __r;
};
    __ui_TabPanel.prototype.__class__.insert = function() {
        return __ui_TabPanel.prototype.insert.call.apply(__ui_TabPanel.prototype.insert, arguments);
    };
    __ui_TabPanel.prototype.__class__.insert.unbound_method = true;
    __ui_TabPanel.prototype.insert.instance_method = true;
    __ui_TabPanel.prototype.__class__.insert.parse_kwargs = __ui_TabPanel.prototype.insert.parse_kwargs;
    __ui_TabPanel.prototype.__iter__ = function() {
    return this.tab_children.__iter__();
    };
    __ui_TabPanel.prototype.__class__.__iter__ = function() {
        return __ui_TabPanel.prototype.__iter__.call.apply(__ui_TabPanel.prototype.__iter__, arguments);
    };
    __ui_TabPanel.prototype.__class__.__iter__.unbound_method = true;
    __ui_TabPanel.prototype.__iter__.instance_method = true;
    __ui_TabPanel.prototype.onBeforeTabSelected = function(sender, tabIndex) {

        var __listener = this.tabListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (!(listener.onBeforeTabSelected(sender, tabIndex))) {
    return false;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return true;
    };
    __ui_TabPanel.prototype.__class__.onBeforeTabSelected = function() {
        return __ui_TabPanel.prototype.onBeforeTabSelected.call.apply(__ui_TabPanel.prototype.onBeforeTabSelected, arguments);
    };
    __ui_TabPanel.prototype.__class__.onBeforeTabSelected.unbound_method = true;
    __ui_TabPanel.prototype.onBeforeTabSelected.instance_method = true;
    __ui_TabPanel.prototype.onTabSelected = function(sender, tabIndex) {
    this.deck.showWidget(tabIndex);

        var __listener = this.tabListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onTabSelected(sender, tabIndex);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_TabPanel.prototype.__class__.onTabSelected = function() {
        return __ui_TabPanel.prototype.onTabSelected.call.apply(__ui_TabPanel.prototype.onTabSelected, arguments);
    };
    __ui_TabPanel.prototype.__class__.onTabSelected.unbound_method = true;
    __ui_TabPanel.prototype.onTabSelected.instance_method = true;
    __ui_TabPanel.prototype.remove = function(widget) {
    if (pyjslib_isNumber(widget)) {
    var widget = this.getWidget(widget);
    }
    var index = this.getWidgetIndex(widget);
    if ((index == -1)) {
    return false;
    }
    this.tab_children.remove(widget);
    this.tabBar.removeTab(index);
    this.deck.remove(widget);
    return true;
    };
    __ui_TabPanel.prototype.__class__.remove = function() {
        return __ui_TabPanel.prototype.remove.call.apply(__ui_TabPanel.prototype.remove, arguments);
    };
    __ui_TabPanel.prototype.__class__.remove.unbound_method = true;
    __ui_TabPanel.prototype.remove.instance_method = true;
    __ui_TabPanel.prototype.removeTabListener = function(listener) {
    this.tabListeners.remove(listener);
    };
    __ui_TabPanel.prototype.__class__.removeTabListener = function() {
        return __ui_TabPanel.prototype.removeTabListener.call.apply(__ui_TabPanel.prototype.removeTabListener, arguments);
    };
    __ui_TabPanel.prototype.__class__.removeTabListener.unbound_method = true;
    __ui_TabPanel.prototype.removeTabListener.instance_method = true;
    __ui_TabPanel.prototype.selectTab = function(index) {
    this.tabBar.selectTab(index);
    };
    __ui_TabPanel.prototype.__class__.selectTab = function() {
        return __ui_TabPanel.prototype.selectTab.call.apply(__ui_TabPanel.prototype.selectTab, arguments);
    };
    __ui_TabPanel.prototype.__class__.selectTab.unbound_method = true;
    __ui_TabPanel.prototype.selectTab.instance_method = true;
}
function __ui_StackPanel() {
}
function ui_StackPanel() {
    var instance = new __ui_StackPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_StackPanel_initialize() {
    if(__ui_StackPanel.__was_initialized__) return;
    __ui_StackPanel.__was_initialized__ = true;
    if(!__ui_ComplexPanel.__was_initialized__)
        __ui_ComplexPanel_initialize();
    pyjs_extend(__ui_StackPanel, __ui_ComplexPanel);
    __ui_StackPanel.prototype.__class__.__new__ = ui_StackPanel;
    __ui_StackPanel.prototype.__init__ = function() {
    __ui_ComplexPanel.prototype.__class__.__init__(this);
    this.body = null;
    this.visibleStack = -1;
    var table = DOM_createTable();
    this.setElement(table);
    this.body = DOM_createTBody();
    DOM_appendChild(table, this.body);
    DOM_setIntAttribute(table, 'cellSpacing', 0);
    DOM_setIntAttribute(table, 'cellPadding', 0);
    DOM_sinkEvents(table, __ui_Event.prototype.__class__.ONCLICK);
    this.setStyleName('gwt-StackPanel');
    };
    __ui_StackPanel.prototype.__class__.__init__ = function() {
        return __ui_StackPanel.prototype.__init__.call.apply(__ui_StackPanel.prototype.__init__, arguments);
    };
    __ui_StackPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_StackPanel.prototype.__init__.instance_method = true;
    __ui_StackPanel.prototype.add = function(widget, stackText, asHTML) {
    if (typeof stackText == 'undefined') stackText='';
    if (typeof asHTML == 'undefined') asHTML=false;
    widget.removeFromParent();
    var index = this.getWidgetCount();
    var tr = DOM_createTR();
    var td = DOM_createTD();
    DOM_appendChild(this.body, tr);
    DOM_appendChild(tr, td);
    this.setStyleName(td, 'gwt-StackPanelItem', true);
    DOM_setIntAttribute(td, '__index', index);
    DOM_setAttribute(td, 'height', '1px');
    var tr = DOM_createTR();
    var td = DOM_createTD();
    DOM_appendChild(this.body, tr);
    DOM_appendChild(tr, td);
    DOM_setAttribute(td, 'height', '100%');
    DOM_setAttribute(td, 'vAlign', 'top');
    __ui_ComplexPanel.prototype.__class__.add(this, widget, td);
    this.setStackVisible(index, false);
    if ((this.visibleStack == -1)) {
    this.showStack(0);
    }
    if ((stackText != '')) {
    this.setStackText( ( this.getWidgetCount() - 1 ) , stackText, asHTML);
    }
    };
__ui_StackPanel.prototype.add.parse_kwargs = function ( __kwargs, widget, stackText, asHTML ) {
    if (typeof stackText == 'undefined')
        stackText=__kwargs.stackText;
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [widget, stackText, asHTML];
    return __r;
};
    __ui_StackPanel.prototype.__class__.add = function() {
        return __ui_StackPanel.prototype.add.call.apply(__ui_StackPanel.prototype.add, arguments);
    };
    __ui_StackPanel.prototype.__class__.add.unbound_method = true;
    __ui_StackPanel.prototype.add.instance_method = true;
    __ui_StackPanel.prototype.__class__.add.parse_kwargs = __ui_StackPanel.prototype.add.parse_kwargs;
    __ui_StackPanel.prototype.getWidget = function(index) {
    return this.children.__getitem__(index);
    };
    __ui_StackPanel.prototype.__class__.getWidget = function() {
        return __ui_StackPanel.prototype.getWidget.call.apply(__ui_StackPanel.prototype.getWidget, arguments);
    };
    __ui_StackPanel.prototype.__class__.getWidget.unbound_method = true;
    __ui_StackPanel.prototype.getWidget.instance_method = true;
    __ui_StackPanel.prototype.getWidgetCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_StackPanel.prototype.__class__.getWidgetCount = function() {
        return __ui_StackPanel.prototype.getWidgetCount.call.apply(__ui_StackPanel.prototype.getWidgetCount, arguments);
    };
    __ui_StackPanel.prototype.__class__.getWidgetCount.unbound_method = true;
    __ui_StackPanel.prototype.getWidgetCount.instance_method = true;
    __ui_StackPanel.prototype.getWidgetIndex = function(child) {
    return this.children.index(child);
    };
    __ui_StackPanel.prototype.__class__.getWidgetIndex = function() {
        return __ui_StackPanel.prototype.getWidgetIndex.call.apply(__ui_StackPanel.prototype.getWidgetIndex, arguments);
    };
    __ui_StackPanel.prototype.__class__.getWidgetIndex.unbound_method = true;
    __ui_StackPanel.prototype.getWidgetIndex.instance_method = true;
    __ui_StackPanel.prototype.onBrowserEvent = function(event) {
    if ((DOM_eventGetType(event) == 'click')) {
    var index = this.getDividerIndex(DOM_eventGetTarget(event));
    if ((index != -1)) {
    this.showStack(index);
    }
    }
    };
    __ui_StackPanel.prototype.__class__.onBrowserEvent = function() {
        return __ui_StackPanel.prototype.onBrowserEvent.call.apply(__ui_StackPanel.prototype.onBrowserEvent, arguments);
    };
    __ui_StackPanel.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_StackPanel.prototype.onBrowserEvent.instance_method = true;
    __ui_StackPanel.prototype.remove = function(child, index) {
    if (typeof index == 'undefined') index=null;
    if ((index == null)) {
    if (pyjslib_isNumber(child)) {
    var index = child;
    var child = this.getWidget(child);
    }
    else {
    var index = this.getWidgetIndex(child);
    }
    }
    if ((child.getParent() != this)) {
    return false;
    }
    if ((this.visibleStack == index)) {
    this.visibleStack = -1;
    }
    else if ((this.visibleStack > index)) {
    this.visibleStack -= 1;
    }
    var rowIndex =  ( 2 * index ) ;
    var tr = DOM_getChild(this.body, rowIndex);
    DOM_removeChild(this.body, tr);
    var tr = DOM_getChild(this.body, rowIndex);
    DOM_removeChild(this.body, tr);
    __ui_ComplexPanel.prototype.__class__.remove(this, child);
    var rows =  ( this.getWidgetCount() * 2 ) ;

        var __i = pyjslib_range(rowIndex, rows, 2).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var childTR = DOM_getChild(this.body, i);
    var td = DOM_getFirstChild(childTR);
    var curIndex = DOM_getIntAttribute(td, '__index');
    DOM_setIntAttribute(td, '__index', index);
    index += 1;

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return true;
    };
__ui_StackPanel.prototype.remove.parse_kwargs = function ( __kwargs, child, index ) {
    if (typeof index == 'undefined')
        index=__kwargs.index;
    var __r = [child, index];
    return __r;
};
    __ui_StackPanel.prototype.__class__.remove = function() {
        return __ui_StackPanel.prototype.remove.call.apply(__ui_StackPanel.prototype.remove, arguments);
    };
    __ui_StackPanel.prototype.__class__.remove.unbound_method = true;
    __ui_StackPanel.prototype.remove.instance_method = true;
    __ui_StackPanel.prototype.__class__.remove.parse_kwargs = __ui_StackPanel.prototype.remove.parse_kwargs;
    __ui_StackPanel.prototype.setStackText = function(index, text, asHTML) {
    if (typeof asHTML == 'undefined') asHTML=false;
    if ((index >= this.getWidgetCount())) {
    return;
    }
    var td = DOM_getChild(DOM_getChild(this.body,  ( index * 2 ) ), 0);
    if (asHTML) {
    DOM_setInnerHTML(td, text);
    }
    else {
    DOM_setInnerText(td, text);
    }
    };
__ui_StackPanel.prototype.setStackText.parse_kwargs = function ( __kwargs, index, text, asHTML ) {
    if (typeof asHTML == 'undefined')
        asHTML=__kwargs.asHTML;
    var __r = [index, text, asHTML];
    return __r;
};
    __ui_StackPanel.prototype.__class__.setStackText = function() {
        return __ui_StackPanel.prototype.setStackText.call.apply(__ui_StackPanel.prototype.setStackText, arguments);
    };
    __ui_StackPanel.prototype.__class__.setStackText.unbound_method = true;
    __ui_StackPanel.prototype.setStackText.instance_method = true;
    __ui_StackPanel.prototype.__class__.setStackText.parse_kwargs = __ui_StackPanel.prototype.setStackText.parse_kwargs;
    __ui_StackPanel.prototype.showStack = function(index) {
    if (((index >= this.getWidgetCount())) || ((index == this.visibleStack))) {
    return;
    }
    if ((this.visibleStack >= 0)) {
    this.setStackVisible(this.visibleStack, false);
    }
    this.visibleStack = index;
    this.setStackVisible(this.visibleStack, true);
    };
    __ui_StackPanel.prototype.__class__.showStack = function() {
        return __ui_StackPanel.prototype.showStack.call.apply(__ui_StackPanel.prototype.showStack, arguments);
    };
    __ui_StackPanel.prototype.__class__.showStack.unbound_method = true;
    __ui_StackPanel.prototype.showStack.instance_method = true;
    __ui_StackPanel.prototype.getDividerIndex = function(elem) {
    while (((elem != null)) && (!(DOM_compare(elem, this.getElement())))) {
    var expando = DOM_getAttribute(elem, '__index');
    if ((expando != null)) {
    return pyjslib_int(expando);
    }
    var elem = DOM_getParent(elem);
    }
    return -1;
    };
    __ui_StackPanel.prototype.__class__.getDividerIndex = function() {
        return __ui_StackPanel.prototype.getDividerIndex.call.apply(__ui_StackPanel.prototype.getDividerIndex, arguments);
    };
    __ui_StackPanel.prototype.__class__.getDividerIndex.unbound_method = true;
    __ui_StackPanel.prototype.getDividerIndex.instance_method = true;
    __ui_StackPanel.prototype.setStackVisible = function(index, visible) {
    var tr = DOM_getChild(this.body,  ( index * 2 ) );
    if ((tr == null)) {
    return;
    }
    var td = DOM_getFirstChild(tr);
    this.setStyleName(td, 'gwt-StackPanelItem-selected', visible);
    var tr = DOM_getChild(this.body,  (  ( index * 2 )  + 1 ) );
    this.setVisible(tr, visible);
    this.getWidget(index).setVisible(visible);
    };
    __ui_StackPanel.prototype.__class__.setStackVisible = function() {
        return __ui_StackPanel.prototype.setStackVisible.call.apply(__ui_StackPanel.prototype.setStackVisible, arguments);
    };
    __ui_StackPanel.prototype.__class__.setStackVisible.unbound_method = true;
    __ui_StackPanel.prototype.setStackVisible.instance_method = true;
    __ui_StackPanel.prototype.getSelectedIndex = function() {
    return this.visibleStack;
    };
    __ui_StackPanel.prototype.__class__.getSelectedIndex = function() {
        return __ui_StackPanel.prototype.getSelectedIndex.call.apply(__ui_StackPanel.prototype.getSelectedIndex, arguments);
    };
    __ui_StackPanel.prototype.__class__.getSelectedIndex.unbound_method = true;
    __ui_StackPanel.prototype.getSelectedIndex.instance_method = true;
}
function __ui_TextBoxBase() {
}
function ui_TextBoxBase(element) {
    var instance = new __ui_TextBoxBase();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TextBoxBase_initialize() {
    if(__ui_TextBoxBase.__was_initialized__) return;
    __ui_TextBoxBase.__was_initialized__ = true;
    if(!__ui_FocusWidget.__was_initialized__)
        __ui_FocusWidget_initialize();
    pyjs_extend(__ui_TextBoxBase, __ui_FocusWidget);
    __ui_TextBoxBase.prototype.__class__.__new__ = ui_TextBoxBase;
    __ui_TextBoxBase.prototype.__class__.ALIGN_CENTER = 'center';
    __ui_TextBoxBase.prototype.__class__.ALIGN_JUSTIFY = 'justify';
    __ui_TextBoxBase.prototype.__class__.ALIGN_LEFT = 'left';
    __ui_TextBoxBase.prototype.__class__.ALIGN_RIGHT = 'right';
    __ui_TextBoxBase.prototype.__init__ = function(element) {
    this.changeListeners = new pyjslib_List([]);
    this.clickListeners = new pyjslib_List([]);
    this.currentEvent = null;
    this.keyboardListeners = new pyjslib_List([]);
    __ui_FocusWidget.prototype.__class__.__init__(this, element);
    this.sinkEvents(__ui_Event.prototype.__class__.ONCHANGE);
    };
    __ui_TextBoxBase.prototype.__class__.__init__ = function() {
        return __ui_TextBoxBase.prototype.__init__.call.apply(__ui_TextBoxBase.prototype.__init__, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.__init__.unbound_method = true;
    __ui_TextBoxBase.prototype.__init__.instance_method = true;
    __ui_TextBoxBase.prototype.addChangeListener = function(listener) {
    this.changeListeners.append(listener);
    };
    __ui_TextBoxBase.prototype.__class__.addChangeListener = function() {
        return __ui_TextBoxBase.prototype.addChangeListener.call.apply(__ui_TextBoxBase.prototype.addChangeListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.addChangeListener.unbound_method = true;
    __ui_TextBoxBase.prototype.addChangeListener.instance_method = true;
    __ui_TextBoxBase.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_TextBoxBase.prototype.__class__.addClickListener = function() {
        return __ui_TextBoxBase.prototype.addClickListener.call.apply(__ui_TextBoxBase.prototype.addClickListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.addClickListener.unbound_method = true;
    __ui_TextBoxBase.prototype.addClickListener.instance_method = true;
    __ui_TextBoxBase.prototype.addKeyboardListener = function(listener) {
    this.keyboardListeners.append(listener);
    };
    __ui_TextBoxBase.prototype.__class__.addKeyboardListener = function() {
        return __ui_TextBoxBase.prototype.addKeyboardListener.call.apply(__ui_TextBoxBase.prototype.addKeyboardListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.addKeyboardListener.unbound_method = true;
    __ui_TextBoxBase.prototype.addKeyboardListener.instance_method = true;
    __ui_TextBoxBase.prototype.cancelKey = function() {
    if ((this.currentEvent != null)) {
    DOM_eventPreventDefault(this.currentEvent);
    }
    };
    __ui_TextBoxBase.prototype.__class__.cancelKey = function() {
        return __ui_TextBoxBase.prototype.cancelKey.call.apply(__ui_TextBoxBase.prototype.cancelKey, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.cancelKey.unbound_method = true;
    __ui_TextBoxBase.prototype.cancelKey.instance_method = true;
    __ui_TextBoxBase.prototype.getCursorPos = function() {

        try {
            var element = this.getElement()
            return element.selectionStart;
        } catch (e) {
            return 0;
        }
        
    };
    __ui_TextBoxBase.prototype.__class__.getCursorPos = function() {
        return __ui_TextBoxBase.prototype.getCursorPos.call.apply(__ui_TextBoxBase.prototype.getCursorPos, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getCursorPos.unbound_method = true;
    __ui_TextBoxBase.prototype.getCursorPos.instance_method = true;
    __ui_TextBoxBase.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_TextBoxBase.prototype.__class__.getName = function() {
        return __ui_TextBoxBase.prototype.getName.call.apply(__ui_TextBoxBase.prototype.getName, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getName.unbound_method = true;
    __ui_TextBoxBase.prototype.getName.instance_method = true;
    __ui_TextBoxBase.prototype.getSelectedText = function() {
    var start = this.getCursorPos();
    var length = this.getSelectionLength();
    var text = this.getText();
    return pyjslib_slice(text, start,  ( start + length ) );
    };
    __ui_TextBoxBase.prototype.__class__.getSelectedText = function() {
        return __ui_TextBoxBase.prototype.getSelectedText.call.apply(__ui_TextBoxBase.prototype.getSelectedText, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getSelectedText.unbound_method = true;
    __ui_TextBoxBase.prototype.getSelectedText.instance_method = true;
    __ui_TextBoxBase.prototype.getSelectionLength = function() {

        try{
            var element = this.getElement()
            return element.selectionEnd - element.selectionStart;
        } catch (e) {
            return 0;
        }
        
    };
    __ui_TextBoxBase.prototype.__class__.getSelectionLength = function() {
        return __ui_TextBoxBase.prototype.getSelectionLength.call.apply(__ui_TextBoxBase.prototype.getSelectionLength, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getSelectionLength.unbound_method = true;
    __ui_TextBoxBase.prototype.getSelectionLength.instance_method = true;
    __ui_TextBoxBase.prototype.getText = function() {
    return DOM_getAttribute(this.getElement(), 'value');
    };
    __ui_TextBoxBase.prototype.__class__.getText = function() {
        return __ui_TextBoxBase.prototype.getText.call.apply(__ui_TextBoxBase.prototype.getText, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.getText.unbound_method = true;
    __ui_TextBoxBase.prototype.getText.instance_method = true;
    __ui_TextBoxBase.prototype.onBrowserEvent = function(event) {
    __ui_FocusWidget.prototype.__class__.onBrowserEvent(this, event);
    var type = DOM_eventGetType(event);
    if ((type == 'change')) {

        var __listener = this.changeListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onChange) {
    listener.onChange(this);
    }
    else {
    listener(this);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __ui_TextBoxBase.prototype.__class__.onBrowserEvent = function() {
        return __ui_TextBoxBase.prototype.onBrowserEvent.call.apply(__ui_TextBoxBase.prototype.onBrowserEvent, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_TextBoxBase.prototype.onBrowserEvent.instance_method = true;
    __ui_TextBoxBase.prototype.removeChangeListener = function(listener) {
    this.changeListeners.remove(listener);
    };
    __ui_TextBoxBase.prototype.__class__.removeChangeListener = function() {
        return __ui_TextBoxBase.prototype.removeChangeListener.call.apply(__ui_TextBoxBase.prototype.removeChangeListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.removeChangeListener.unbound_method = true;
    __ui_TextBoxBase.prototype.removeChangeListener.instance_method = true;
    __ui_TextBoxBase.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_TextBoxBase.prototype.__class__.removeClickListener = function() {
        return __ui_TextBoxBase.prototype.removeClickListener.call.apply(__ui_TextBoxBase.prototype.removeClickListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_TextBoxBase.prototype.removeClickListener.instance_method = true;
    __ui_TextBoxBase.prototype.removeKeyboardListener = function(listener) {
    this.keyboardListeners.remove(listener);
    };
    __ui_TextBoxBase.prototype.__class__.removeKeyboardListener = function() {
        return __ui_TextBoxBase.prototype.removeKeyboardListener.call.apply(__ui_TextBoxBase.prototype.removeKeyboardListener, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.removeKeyboardListener.unbound_method = true;
    __ui_TextBoxBase.prototype.removeKeyboardListener.instance_method = true;
    __ui_TextBoxBase.prototype.selectAll = function() {
    var length = pyjslib_len(this.getText());
    if ((length > 0)) {
    this.setSelectionRange(0, length);
    }
    };
    __ui_TextBoxBase.prototype.__class__.selectAll = function() {
        return __ui_TextBoxBase.prototype.selectAll.call.apply(__ui_TextBoxBase.prototype.selectAll, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.selectAll.unbound_method = true;
    __ui_TextBoxBase.prototype.selectAll.instance_method = true;
    __ui_TextBoxBase.prototype.setCursorPos = function(pos) {
    this.setSelectionRange(pos, 0);
    };
    __ui_TextBoxBase.prototype.__class__.setCursorPos = function() {
        return __ui_TextBoxBase.prototype.setCursorPos.call.apply(__ui_TextBoxBase.prototype.setCursorPos, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setCursorPos.unbound_method = true;
    __ui_TextBoxBase.prototype.setCursorPos.instance_method = true;
    __ui_TextBoxBase.prototype.setKey = function(key) {
    if ((this.currentEvent != null)) {
    DOM_eventSetKeyCode(this.currentEvent, key);
    }
    };
    __ui_TextBoxBase.prototype.__class__.setKey = function() {
        return __ui_TextBoxBase.prototype.setKey.call.apply(__ui_TextBoxBase.prototype.setKey, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setKey.unbound_method = true;
    __ui_TextBoxBase.prototype.setKey.instance_method = true;
    __ui_TextBoxBase.prototype.setName = function(name) {
    DOM_setAttribute(this.getElement(), 'name', name);
    };
    __ui_TextBoxBase.prototype.__class__.setName = function() {
        return __ui_TextBoxBase.prototype.setName.call.apply(__ui_TextBoxBase.prototype.setName, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setName.unbound_method = true;
    __ui_TextBoxBase.prototype.setName.instance_method = true;
    __ui_TextBoxBase.prototype.setSelectionRange = function(pos, length) {
    if ((length < 0)) {
    console.error( ( 'Length must be a positive integer. Length: ' + length ) );
    }
    if (((pos < 0)) || (( ( length + pos )  > pyjslib_len(this.getText())))) {
    console.error( (  (  (  (  ( 'From Index: ' + pos )  + '  To Index: ' )  +  ( pos + length )  )  + '  Text Length: ' )  + pyjslib_len(this.getText()) ) );
    }
    var element = this.getElement();
    element.setSelectionRange(pos,  ( pos + length ) );
    };
    __ui_TextBoxBase.prototype.__class__.setSelectionRange = function() {
        return __ui_TextBoxBase.prototype.setSelectionRange.call.apply(__ui_TextBoxBase.prototype.setSelectionRange, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setSelectionRange.unbound_method = true;
    __ui_TextBoxBase.prototype.setSelectionRange.instance_method = true;
    __ui_TextBoxBase.prototype.setText = function(text) {
    DOM_setAttribute(this.getElement(), 'value', text);
    };
    __ui_TextBoxBase.prototype.__class__.setText = function() {
        return __ui_TextBoxBase.prototype.setText.call.apply(__ui_TextBoxBase.prototype.setText, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setText.unbound_method = true;
    __ui_TextBoxBase.prototype.setText.instance_method = true;
    __ui_TextBoxBase.prototype.setTextAlignment = function(align) {
    DOM_setStyleAttribute(this.getElement(), 'textAlign', align);
    };
    __ui_TextBoxBase.prototype.__class__.setTextAlignment = function() {
        return __ui_TextBoxBase.prototype.setTextAlignment.call.apply(__ui_TextBoxBase.prototype.setTextAlignment, arguments);
    };
    __ui_TextBoxBase.prototype.__class__.setTextAlignment.unbound_method = true;
    __ui_TextBoxBase.prototype.setTextAlignment.instance_method = true;
}
function __ui_TextBox() {
}
function ui_TextBox() {
    var instance = new __ui_TextBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TextBox_initialize() {
    if(__ui_TextBox.__was_initialized__) return;
    __ui_TextBox.__was_initialized__ = true;
    if(!__ui_TextBoxBase.__was_initialized__)
        __ui_TextBoxBase_initialize();
    pyjs_extend(__ui_TextBox, __ui_TextBoxBase);
    __ui_TextBox.prototype.__class__.__new__ = ui_TextBox;
    __ui_TextBox.prototype.__init__ = function() {
    __ui_TextBoxBase.prototype.__class__.__init__(this, DOM_createInputText());
    this.setStyleName('gwt-TextBox');
    };
    __ui_TextBox.prototype.__class__.__init__ = function() {
        return __ui_TextBox.prototype.__init__.call.apply(__ui_TextBox.prototype.__init__, arguments);
    };
    __ui_TextBox.prototype.__class__.__init__.unbound_method = true;
    __ui_TextBox.prototype.__init__.instance_method = true;
    __ui_TextBox.prototype.getMaxLength = function() {
    return DOM_getIntAttribute(this.getElement(), 'maxLength');
    };
    __ui_TextBox.prototype.__class__.getMaxLength = function() {
        return __ui_TextBox.prototype.getMaxLength.call.apply(__ui_TextBox.prototype.getMaxLength, arguments);
    };
    __ui_TextBox.prototype.__class__.getMaxLength.unbound_method = true;
    __ui_TextBox.prototype.getMaxLength.instance_method = true;
    __ui_TextBox.prototype.getVisibleLength = function() {
    return DOM_getIntAttribute(this.getElement(), 'size');
    };
    __ui_TextBox.prototype.__class__.getVisibleLength = function() {
        return __ui_TextBox.prototype.getVisibleLength.call.apply(__ui_TextBox.prototype.getVisibleLength, arguments);
    };
    __ui_TextBox.prototype.__class__.getVisibleLength.unbound_method = true;
    __ui_TextBox.prototype.getVisibleLength.instance_method = true;
    __ui_TextBox.prototype.setMaxLength = function(length) {
    DOM_setIntAttribute(this.getElement(), 'maxLength', length);
    };
    __ui_TextBox.prototype.__class__.setMaxLength = function() {
        return __ui_TextBox.prototype.setMaxLength.call.apply(__ui_TextBox.prototype.setMaxLength, arguments);
    };
    __ui_TextBox.prototype.__class__.setMaxLength.unbound_method = true;
    __ui_TextBox.prototype.setMaxLength.instance_method = true;
    __ui_TextBox.prototype.setVisibleLength = function(length) {
    DOM_setIntAttribute(this.getElement(), 'size', length);
    };
    __ui_TextBox.prototype.__class__.setVisibleLength = function() {
        return __ui_TextBox.prototype.setVisibleLength.call.apply(__ui_TextBox.prototype.setVisibleLength, arguments);
    };
    __ui_TextBox.prototype.__class__.setVisibleLength.unbound_method = true;
    __ui_TextBox.prototype.setVisibleLength.instance_method = true;
}
function __ui_PasswordTextBox() {
}
function ui_PasswordTextBox() {
    var instance = new __ui_PasswordTextBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_PasswordTextBox_initialize() {
    if(__ui_PasswordTextBox.__was_initialized__) return;
    __ui_PasswordTextBox.__was_initialized__ = true;
    if(!__ui_TextBoxBase.__was_initialized__)
        __ui_TextBoxBase_initialize();
    pyjs_extend(__ui_PasswordTextBox, __ui_TextBoxBase);
    __ui_PasswordTextBox.prototype.__class__.__new__ = ui_PasswordTextBox;
    __ui_PasswordTextBox.prototype.__init__ = function() {
    __ui_TextBoxBase.prototype.__class__.__init__(this, DOM_createInputPassword());
    this.setStyleName('gwt-PasswordTextBox');
    };
    __ui_PasswordTextBox.prototype.__class__.__init__ = function() {
        return __ui_PasswordTextBox.prototype.__init__.call.apply(__ui_PasswordTextBox.prototype.__init__, arguments);
    };
    __ui_PasswordTextBox.prototype.__class__.__init__.unbound_method = true;
    __ui_PasswordTextBox.prototype.__init__.instance_method = true;
}
function __ui_TextArea() {
}
function ui_TextArea() {
    var instance = new __ui_TextArea();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TextArea_initialize() {
    if(__ui_TextArea.__was_initialized__) return;
    __ui_TextArea.__was_initialized__ = true;
    if(!__ui_TextBoxBase.__was_initialized__)
        __ui_TextBoxBase_initialize();
    pyjs_extend(__ui_TextArea, __ui_TextBoxBase);
    __ui_TextArea.prototype.__class__.__new__ = ui_TextArea;
    __ui_TextArea.prototype.__init__ = function() {
    __ui_TextBoxBase.prototype.__class__.__init__(this, DOM_createTextArea());
    this.setStyleName('gwt-TextArea');
    };
    __ui_TextArea.prototype.__class__.__init__ = function() {
        return __ui_TextArea.prototype.__init__.call.apply(__ui_TextArea.prototype.__init__, arguments);
    };
    __ui_TextArea.prototype.__class__.__init__.unbound_method = true;
    __ui_TextArea.prototype.__init__.instance_method = true;
    __ui_TextArea.prototype.getCharacterWidth = function() {
    return DOM_getIntAttribute(this.getElement(), 'cols');
    };
    __ui_TextArea.prototype.__class__.getCharacterWidth = function() {
        return __ui_TextArea.prototype.getCharacterWidth.call.apply(__ui_TextArea.prototype.getCharacterWidth, arguments);
    };
    __ui_TextArea.prototype.__class__.getCharacterWidth.unbound_method = true;
    __ui_TextArea.prototype.getCharacterWidth.instance_method = true;
    __ui_TextArea.prototype.getCursorPos = function() {
    return __ui_TextBoxBase.prototype.__class__.getCursorPos(this);
    };
    __ui_TextArea.prototype.__class__.getCursorPos = function() {
        return __ui_TextArea.prototype.getCursorPos.call.apply(__ui_TextArea.prototype.getCursorPos, arguments);
    };
    __ui_TextArea.prototype.__class__.getCursorPos.unbound_method = true;
    __ui_TextArea.prototype.getCursorPos.instance_method = true;
    __ui_TextArea.prototype.getVisibleLines = function() {
    return DOM_getIntAttribute(this.getElement(), 'rows');
    };
    __ui_TextArea.prototype.__class__.getVisibleLines = function() {
        return __ui_TextArea.prototype.getVisibleLines.call.apply(__ui_TextArea.prototype.getVisibleLines, arguments);
    };
    __ui_TextArea.prototype.__class__.getVisibleLines.unbound_method = true;
    __ui_TextArea.prototype.getVisibleLines.instance_method = true;
    __ui_TextArea.prototype.setCharacterWidth = function(width) {
    DOM_setIntAttribute(this.getElement(), 'cols', width);
    };
    __ui_TextArea.prototype.__class__.setCharacterWidth = function() {
        return __ui_TextArea.prototype.setCharacterWidth.call.apply(__ui_TextArea.prototype.setCharacterWidth, arguments);
    };
    __ui_TextArea.prototype.__class__.setCharacterWidth.unbound_method = true;
    __ui_TextArea.prototype.setCharacterWidth.instance_method = true;
    __ui_TextArea.prototype.setVisibleLines = function(lines) {
    DOM_setIntAttribute(this.getElement(), 'rows', lines);
    };
    __ui_TextArea.prototype.__class__.setVisibleLines = function() {
        return __ui_TextArea.prototype.setVisibleLines.call.apply(__ui_TextArea.prototype.setVisibleLines, arguments);
    };
    __ui_TextArea.prototype.__class__.setVisibleLines.unbound_method = true;
    __ui_TextArea.prototype.setVisibleLines.instance_method = true;
}
function __ui_TreeContentPanel() {
}
function ui_TreeContentPanel(element) {
    var instance = new __ui_TreeContentPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_TreeContentPanel_initialize() {
    if(__ui_TreeContentPanel.__was_initialized__) return;
    __ui_TreeContentPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_TreeContentPanel, __ui_SimplePanel);
    __ui_TreeContentPanel.prototype.__class__.__new__ = ui_TreeContentPanel;
    __ui_TreeContentPanel.prototype.__init__ = function(element) {
    __ui_SimplePanel.prototype.__class__.__init__(this, element);
    this.tree_item = null;
    };
    __ui_TreeContentPanel.prototype.__class__.__init__ = function() {
        return __ui_TreeContentPanel.prototype.__init__.call.apply(__ui_TreeContentPanel.prototype.__init__, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_TreeContentPanel.prototype.__init__.instance_method = true;
    __ui_TreeContentPanel.prototype.getTreeItem = function() {
    return this.tree_item;
    };
    __ui_TreeContentPanel.prototype.__class__.getTreeItem = function() {
        return __ui_TreeContentPanel.prototype.getTreeItem.call.apply(__ui_TreeContentPanel.prototype.getTreeItem, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.getTreeItem.unbound_method = true;
    __ui_TreeContentPanel.prototype.getTreeItem.instance_method = true;
    __ui_TreeContentPanel.prototype.setTreeItem = function(tree_item) {
    this.tree_item = tree_item;
    };
    __ui_TreeContentPanel.prototype.__class__.setTreeItem = function() {
        return __ui_TreeContentPanel.prototype.setTreeItem.call.apply(__ui_TreeContentPanel.prototype.setTreeItem, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.setTreeItem.unbound_method = true;
    __ui_TreeContentPanel.prototype.setTreeItem.instance_method = true;
    __ui_TreeContentPanel.prototype.setParent = function(widget) {
    console.error('Cannot directly setParent on a WidgetTreeItem\'s ContentPanel');
    };
    __ui_TreeContentPanel.prototype.__class__.setParent = function() {
        return __ui_TreeContentPanel.prototype.setParent.call.apply(__ui_TreeContentPanel.prototype.setParent, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.setParent.unbound_method = true;
    __ui_TreeContentPanel.prototype.setParent.instance_method = true;
    __ui_TreeContentPanel.prototype.treeSetParent = function(widget) {
    __ui_SimplePanel.prototype.__class__.setParent(this, widget);
    };
    __ui_TreeContentPanel.prototype.__class__.treeSetParent = function() {
        return __ui_TreeContentPanel.prototype.treeSetParent.call.apply(__ui_TreeContentPanel.prototype.treeSetParent, arguments);
    };
    __ui_TreeContentPanel.prototype.__class__.treeSetParent.unbound_method = true;
    __ui_TreeContentPanel.prototype.treeSetParent.instance_method = true;
}
function __ui_TreeItem() {
}
function ui_TreeItem(html) {
    if (typeof html == 'undefined') html=null;
    var instance = new __ui_TreeItem();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_TreeItem.parse_kwargs = function ( __kwargs, html ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    var __r = [html];
    return __r;
};
function __ui_TreeItem_initialize() {
    if(__ui_TreeItem.__was_initialized__) return;
    __ui_TreeItem.__was_initialized__ = true;
    if(!__ui_UIObject.__was_initialized__)
        __ui_UIObject_initialize();
    pyjs_extend(__ui_TreeItem, __ui_UIObject);
    __ui_TreeItem.prototype.__class__.__new__ = ui_TreeItem;
    __ui_TreeItem.prototype.__init__ = function(html) {
    if (typeof html == 'undefined') html=null;
    this.children = new pyjslib_List([]);
    this.contentPanel = null;
    this.itemTable = null;
    this.contentElem = null;
    this.imgElem = null;
    this.childSpanElem = null;
    this.open = false;
    this.parent = null;
    this.selected = false;
    this.tree = null;
    this.userObject = null;
    this.setElement(DOM_createDiv());
    this.itemTable = DOM_createTable();
    this.contentElem = DOM_createSpan();
    this.childSpanElem = DOM_createSpan();
    this.imgElem = DOM_createImg();
    var tbody = DOM_createTBody();
    var tr = DOM_createTR();
    var tdImg = DOM_createTD();
    var tdContent = DOM_createTD();
    DOM_appendChild(this.itemTable, tbody);
    DOM_appendChild(tbody, tr);
    DOM_appendChild(tr, tdImg);
    DOM_appendChild(tr, tdContent);
    DOM_setStyleAttribute(tdImg, 'verticalAlign', 'middle');
    DOM_setStyleAttribute(tdContent, 'verticalAlign', 'middle');
    DOM_setStyleAttribute(this.getElement(), 'cursor', 'pointer');
    DOM_appendChild(this.getElement(), this.itemTable);
    DOM_appendChild(this.getElement(), this.childSpanElem);
    DOM_appendChild(tdImg, this.imgElem);
    DOM_appendChild(tdContent, this.contentElem);
    DOM_setAttribute(this.getElement(), 'position', 'relative');
    DOM_setStyleAttribute(this.contentElem, 'display', 'inline');
    DOM_setStyleAttribute(this.getElement(), 'whiteSpace', 'nowrap');
    DOM_setAttribute(this.itemTable, 'whiteSpace', 'nowrap');
    DOM_setStyleAttribute(this.childSpanElem, 'whiteSpace', 'nowrap');
    this.setStyleName(this.contentElem, 'gwt-TreeItem', true);
    if ((html != null)) {
    if (pyjslib_isString(html)) {
    this.setHTML(html);
    }
    else {
    this.setWidget(html);
    }
    }
    };
__ui_TreeItem.prototype.__init__.parse_kwargs = function ( __kwargs, html ) {
    if (typeof html == 'undefined')
        html=__kwargs.html;
    var __r = [html];
    return __r;
};
    __ui_TreeItem.prototype.__class__.__init__ = function() {
        return __ui_TreeItem.prototype.__init__.call.apply(__ui_TreeItem.prototype.__init__, arguments);
    };
    __ui_TreeItem.prototype.__class__.__init__.unbound_method = true;
    __ui_TreeItem.prototype.__init__.instance_method = true;
    __ui_TreeItem.prototype.__class__.__init__.parse_kwargs = __ui_TreeItem.prototype.__init__.parse_kwargs;
    __ui_TreeItem.prototype.addItem = function(item) {
    if (!(pyjslib_hasattr(item, 'getTree'))) {
    var item = ui_TreeItem(item);
    }
    if (((item.getParentItem() != null)) || ((item.getTree() != null))) {
    item.remove();
    }
    item.setTree(this.tree);
    item.setParentItem(this);
    this.children.append(item);
    DOM_setStyleAttribute(item.getElement(), 'marginLeft',  ( 16 + 'px' ) );
    DOM_appendChild(this.childSpanElem, item.getElement());
    if ((pyjslib_len(this.children) == 1)) {
    this.updateState();
    }
    return item;
    };
    __ui_TreeItem.prototype.__class__.addItem = function() {
        return __ui_TreeItem.prototype.addItem.call.apply(__ui_TreeItem.prototype.addItem, arguments);
    };
    __ui_TreeItem.prototype.__class__.addItem.unbound_method = true;
    __ui_TreeItem.prototype.addItem.instance_method = true;
    __ui_TreeItem.prototype.getChild = function(index) {
    if (((index < 0)) || ((index >= pyjslib_len(this.children)))) {
    return;
    }
    return this.children.__getitem__(index);
    };
    __ui_TreeItem.prototype.__class__.getChild = function() {
        return __ui_TreeItem.prototype.getChild.call.apply(__ui_TreeItem.prototype.getChild, arguments);
    };
    __ui_TreeItem.prototype.__class__.getChild.unbound_method = true;
    __ui_TreeItem.prototype.getChild.instance_method = true;
    __ui_TreeItem.prototype.getChildCount = function() {
    return pyjslib_len(this.children);
    };
    __ui_TreeItem.prototype.__class__.getChildCount = function() {
        return __ui_TreeItem.prototype.getChildCount.call.apply(__ui_TreeItem.prototype.getChildCount, arguments);
    };
    __ui_TreeItem.prototype.__class__.getChildCount.unbound_method = true;
    __ui_TreeItem.prototype.getChildCount.instance_method = true;
    __ui_TreeItem.prototype.getChildIndex = function(child) {
    return this.children.index(child);
    };
    __ui_TreeItem.prototype.__class__.getChildIndex = function() {
        return __ui_TreeItem.prototype.getChildIndex.call.apply(__ui_TreeItem.prototype.getChildIndex, arguments);
    };
    __ui_TreeItem.prototype.__class__.getChildIndex.unbound_method = true;
    __ui_TreeItem.prototype.getChildIndex.instance_method = true;
    __ui_TreeItem.prototype.getHTML = function() {
    return DOM_getInnerHTML(this.contentElem);
    };
    __ui_TreeItem.prototype.__class__.getHTML = function() {
        return __ui_TreeItem.prototype.getHTML.call.apply(__ui_TreeItem.prototype.getHTML, arguments);
    };
    __ui_TreeItem.prototype.__class__.getHTML.unbound_method = true;
    __ui_TreeItem.prototype.getHTML.instance_method = true;
    __ui_TreeItem.prototype.getText = function() {
    return DOM_getInnerText(this.contentElem);
    };
    __ui_TreeItem.prototype.__class__.getText = function() {
        return __ui_TreeItem.prototype.getText.call.apply(__ui_TreeItem.prototype.getText, arguments);
    };
    __ui_TreeItem.prototype.__class__.getText.unbound_method = true;
    __ui_TreeItem.prototype.getText.instance_method = true;
    __ui_TreeItem.prototype.getParentItem = function() {
    return this.parent;
    };
    __ui_TreeItem.prototype.__class__.getParentItem = function() {
        return __ui_TreeItem.prototype.getParentItem.call.apply(__ui_TreeItem.prototype.getParentItem, arguments);
    };
    __ui_TreeItem.prototype.__class__.getParentItem.unbound_method = true;
    __ui_TreeItem.prototype.getParentItem.instance_method = true;
    __ui_TreeItem.prototype.getState = function() {
    return this.open;
    };
    __ui_TreeItem.prototype.__class__.getState = function() {
        return __ui_TreeItem.prototype.getState.call.apply(__ui_TreeItem.prototype.getState, arguments);
    };
    __ui_TreeItem.prototype.__class__.getState.unbound_method = true;
    __ui_TreeItem.prototype.getState.instance_method = true;
    __ui_TreeItem.prototype.getTree = function() {
    return this.tree;
    };
    __ui_TreeItem.prototype.__class__.getTree = function() {
        return __ui_TreeItem.prototype.getTree.call.apply(__ui_TreeItem.prototype.getTree, arguments);
    };
    __ui_TreeItem.prototype.__class__.getTree.unbound_method = true;
    __ui_TreeItem.prototype.getTree.instance_method = true;
    __ui_TreeItem.prototype.getUserObject = function() {
    return this.userObject;
    };
    __ui_TreeItem.prototype.__class__.getUserObject = function() {
        return __ui_TreeItem.prototype.getUserObject.call.apply(__ui_TreeItem.prototype.getUserObject, arguments);
    };
    __ui_TreeItem.prototype.__class__.getUserObject.unbound_method = true;
    __ui_TreeItem.prototype.getUserObject.instance_method = true;
    __ui_TreeItem.prototype.getWidget = function() {
    if ((this.contentPanel == null)) {
    return;
    }
    return this.contentPanel.getWidget();
    };
    __ui_TreeItem.prototype.__class__.getWidget = function() {
        return __ui_TreeItem.prototype.getWidget.call.apply(__ui_TreeItem.prototype.getWidget, arguments);
    };
    __ui_TreeItem.prototype.__class__.getWidget.unbound_method = true;
    __ui_TreeItem.prototype.getWidget.instance_method = true;
    __ui_TreeItem.prototype.isSelected = function() {
    return this.selected;
    };
    __ui_TreeItem.prototype.__class__.isSelected = function() {
        return __ui_TreeItem.prototype.isSelected.call.apply(__ui_TreeItem.prototype.isSelected, arguments);
    };
    __ui_TreeItem.prototype.__class__.isSelected.unbound_method = true;
    __ui_TreeItem.prototype.isSelected.instance_method = true;
    __ui_TreeItem.prototype.remove = function() {
    if ((this.parent != null)) {
    this.parent.removeItem(this);
    }
    else if ((this.tree != null)) {
    this.tree.removeItem(this);
    }
    };
    __ui_TreeItem.prototype.__class__.remove = function() {
        return __ui_TreeItem.prototype.remove.call.apply(__ui_TreeItem.prototype.remove, arguments);
    };
    __ui_TreeItem.prototype.__class__.remove.unbound_method = true;
    __ui_TreeItem.prototype.remove.instance_method = true;
    __ui_TreeItem.prototype.removeItem = function(item) {
    if (!this.children.__contains__(item)) {
    return;
    }
    item.setTree(null);
    item.setParentItem(null);
    this.children.remove(item);
    DOM_removeChild(this.childSpanElem, item.getElement());
    if ((pyjslib_len(this.children) == 0)) {
    this.updateState();
    }
    };
    __ui_TreeItem.prototype.__class__.removeItem = function() {
        return __ui_TreeItem.prototype.removeItem.call.apply(__ui_TreeItem.prototype.removeItem, arguments);
    };
    __ui_TreeItem.prototype.__class__.removeItem.unbound_method = true;
    __ui_TreeItem.prototype.removeItem.instance_method = true;
    __ui_TreeItem.prototype.removeItems = function() {
    while ((this.getChildCount() > 0)) {
    this.removeItem(this.getChild(0));
    }
    };
    __ui_TreeItem.prototype.__class__.removeItems = function() {
        return __ui_TreeItem.prototype.removeItems.call.apply(__ui_TreeItem.prototype.removeItems, arguments);
    };
    __ui_TreeItem.prototype.__class__.removeItems.unbound_method = true;
    __ui_TreeItem.prototype.removeItems.instance_method = true;
    __ui_TreeItem.prototype.setHTML = function(html) {
    this.clearContentPanel();
    DOM_setInnerHTML(this.contentElem, html);
    };
    __ui_TreeItem.prototype.__class__.setHTML = function() {
        return __ui_TreeItem.prototype.setHTML.call.apply(__ui_TreeItem.prototype.setHTML, arguments);
    };
    __ui_TreeItem.prototype.__class__.setHTML.unbound_method = true;
    __ui_TreeItem.prototype.setHTML.instance_method = true;
    __ui_TreeItem.prototype.setText = function(text) {
    this.clearContentPanel();
    DOM_setInnerText(this.contentElem, text);
    };
    __ui_TreeItem.prototype.__class__.setText = function() {
        return __ui_TreeItem.prototype.setText.call.apply(__ui_TreeItem.prototype.setText, arguments);
    };
    __ui_TreeItem.prototype.__class__.setText.unbound_method = true;
    __ui_TreeItem.prototype.setText.instance_method = true;
    __ui_TreeItem.prototype.setSelected = function(selected) {
    if ((this.selected == selected)) {
    return;
    }
    this.selected = selected;
    this.setStyleName(this.contentElem, 'gwt-TreeItem-selected', selected);
    };
    __ui_TreeItem.prototype.__class__.setSelected = function() {
        return __ui_TreeItem.prototype.setSelected.call.apply(__ui_TreeItem.prototype.setSelected, arguments);
    };
    __ui_TreeItem.prototype.__class__.setSelected.unbound_method = true;
    __ui_TreeItem.prototype.setSelected.instance_method = true;
    __ui_TreeItem.prototype.setState = function(open, fireEvents) {
    if (typeof fireEvents == 'undefined') fireEvents=true;
    if ((!(open)) || ((pyjslib_len(this.children) != 0))) {
    this.open = open;
    this.updateState();
    }
    if (fireEvents) {
    this.tree.fireStateChanged(this);
    }
    };
__ui_TreeItem.prototype.setState.parse_kwargs = function ( __kwargs, open, fireEvents ) {
    if (typeof fireEvents == 'undefined')
        fireEvents=__kwargs.fireEvents;
    var __r = [open, fireEvents];
    return __r;
};
    __ui_TreeItem.prototype.__class__.setState = function() {
        return __ui_TreeItem.prototype.setState.call.apply(__ui_TreeItem.prototype.setState, arguments);
    };
    __ui_TreeItem.prototype.__class__.setState.unbound_method = true;
    __ui_TreeItem.prototype.setState.instance_method = true;
    __ui_TreeItem.prototype.__class__.setState.parse_kwargs = __ui_TreeItem.prototype.setState.parse_kwargs;
    __ui_TreeItem.prototype.setUserObject = function(userObj) {
    this.userObject = userObj;
    };
    __ui_TreeItem.prototype.__class__.setUserObject = function() {
        return __ui_TreeItem.prototype.setUserObject.call.apply(__ui_TreeItem.prototype.setUserObject, arguments);
    };
    __ui_TreeItem.prototype.__class__.setUserObject.unbound_method = true;
    __ui_TreeItem.prototype.setUserObject.instance_method = true;
    __ui_TreeItem.prototype.setWidget = function(widget) {
    this.ensureContentPanel();
    this.contentPanel.setWidget(widget);
    };
    __ui_TreeItem.prototype.__class__.setWidget = function() {
        return __ui_TreeItem.prototype.setWidget.call.apply(__ui_TreeItem.prototype.setWidget, arguments);
    };
    __ui_TreeItem.prototype.__class__.setWidget.unbound_method = true;
    __ui_TreeItem.prototype.setWidget.instance_method = true;
    __ui_TreeItem.prototype.clearContentPanel = function() {
    if ((this.contentPanel != null)) {
    var child = this.contentPanel.getWidget();
    if ((child != null)) {
    this.contentPanel.remove(child);
    }
    if ((this.tree != null)) {
    this.tree.disown(this.contentPanel);
    this.contentPanel = null;
    }
    }
    };
    __ui_TreeItem.prototype.__class__.clearContentPanel = function() {
        return __ui_TreeItem.prototype.clearContentPanel.call.apply(__ui_TreeItem.prototype.clearContentPanel, arguments);
    };
    __ui_TreeItem.prototype.__class__.clearContentPanel.unbound_method = true;
    __ui_TreeItem.prototype.clearContentPanel.instance_method = true;
    __ui_TreeItem.prototype.ensureContentPanel = function() {
    if ((this.contentPanel == null)) {
    DOM_setInnerHTML(this.contentElem, '');
    this.contentPanel = ui_TreeContentPanel(this.contentElem);
    this.contentPanel.setTreeItem(this);
    if ((this.getTree() != null)) {
    this.tree.adopt(this.contentPanel);
    }
    }
    };
    __ui_TreeItem.prototype.__class__.ensureContentPanel = function() {
        return __ui_TreeItem.prototype.ensureContentPanel.call.apply(__ui_TreeItem.prototype.ensureContentPanel, arguments);
    };
    __ui_TreeItem.prototype.__class__.ensureContentPanel.unbound_method = true;
    __ui_TreeItem.prototype.ensureContentPanel.instance_method = true;
    __ui_TreeItem.prototype.addTreeItems = function(accum) {

        var __item = this.children.__iter__();
        try {
            while (true) {
                var item = __item.next();
                
        
    accum.append(item);
    item.addTreeItems(accum);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_TreeItem.prototype.__class__.addTreeItems = function() {
        return __ui_TreeItem.prototype.addTreeItems.call.apply(__ui_TreeItem.prototype.addTreeItems, arguments);
    };
    __ui_TreeItem.prototype.__class__.addTreeItems.unbound_method = true;
    __ui_TreeItem.prototype.addTreeItems.instance_method = true;
    __ui_TreeItem.prototype.getChildren = function() {
    return this.children;
    };
    __ui_TreeItem.prototype.__class__.getChildren = function() {
        return __ui_TreeItem.prototype.getChildren.call.apply(__ui_TreeItem.prototype.getChildren, arguments);
    };
    __ui_TreeItem.prototype.__class__.getChildren.unbound_method = true;
    __ui_TreeItem.prototype.getChildren.instance_method = true;
    __ui_TreeItem.prototype.getContentElem = function() {
    return this.contentElem;
    };
    __ui_TreeItem.prototype.__class__.getContentElem = function() {
        return __ui_TreeItem.prototype.getContentElem.call.apply(__ui_TreeItem.prototype.getContentElem, arguments);
    };
    __ui_TreeItem.prototype.__class__.getContentElem.unbound_method = true;
    __ui_TreeItem.prototype.getContentElem.instance_method = true;
    __ui_TreeItem.prototype.getContentHeight = function() {
    return DOM_getIntAttribute(this.itemTable, 'offsetHeight');
    };
    __ui_TreeItem.prototype.__class__.getContentHeight = function() {
        return __ui_TreeItem.prototype.getContentHeight.call.apply(__ui_TreeItem.prototype.getContentHeight, arguments);
    };
    __ui_TreeItem.prototype.__class__.getContentHeight.unbound_method = true;
    __ui_TreeItem.prototype.getContentHeight.instance_method = true;
    __ui_TreeItem.prototype.getImageElement = function() {
    return this.imgElem;
    };
    __ui_TreeItem.prototype.__class__.getImageElement = function() {
        return __ui_TreeItem.prototype.getImageElement.call.apply(__ui_TreeItem.prototype.getImageElement, arguments);
    };
    __ui_TreeItem.prototype.__class__.getImageElement.unbound_method = true;
    __ui_TreeItem.prototype.getImageElement.instance_method = true;
    __ui_TreeItem.prototype.getTreeTop = function() {
    var item = this;
    var ret = 0;
    while ((item != null)) {
    ret += DOM_getIntAttribute(item.getElement(), 'offsetTop');
    var item = item.getParentItem();
    }
    return ret;
    };
    __ui_TreeItem.prototype.__class__.getTreeTop = function() {
        return __ui_TreeItem.prototype.getTreeTop.call.apply(__ui_TreeItem.prototype.getTreeTop, arguments);
    };
    __ui_TreeItem.prototype.__class__.getTreeTop.unbound_method = true;
    __ui_TreeItem.prototype.getTreeTop.instance_method = true;
    __ui_TreeItem.prototype.getFocusableWidget = function() {
    var widget = this.getWidget();
    if (pyjslib_hasattr(widget, 'setFocus')) {
    return widget;
    }
    return;
    };
    __ui_TreeItem.prototype.__class__.getFocusableWidget = function() {
        return __ui_TreeItem.prototype.getFocusableWidget.call.apply(__ui_TreeItem.prototype.getFocusableWidget, arguments);
    };
    __ui_TreeItem.prototype.__class__.getFocusableWidget.unbound_method = true;
    __ui_TreeItem.prototype.getFocusableWidget.instance_method = true;
    __ui_TreeItem.prototype.imgSrc = function(img) {
    if ((this.tree == null)) {
    return img;
    }
    var src =  ( this.tree.getImageBase() + img ) ;
    return src;
    };
    __ui_TreeItem.prototype.__class__.imgSrc = function() {
        return __ui_TreeItem.prototype.imgSrc.call.apply(__ui_TreeItem.prototype.imgSrc, arguments);
    };
    __ui_TreeItem.prototype.__class__.imgSrc.unbound_method = true;
    __ui_TreeItem.prototype.imgSrc.instance_method = true;
    __ui_TreeItem.prototype.setParentItem = function(parent) {
    this.parent = parent;
    };
    __ui_TreeItem.prototype.__class__.setParentItem = function() {
        return __ui_TreeItem.prototype.setParentItem.call.apply(__ui_TreeItem.prototype.setParentItem, arguments);
    };
    __ui_TreeItem.prototype.__class__.setParentItem.unbound_method = true;
    __ui_TreeItem.prototype.setParentItem.instance_method = true;
    __ui_TreeItem.prototype.setTree = function(tree) {
    if ((this.tree == tree)) {
    return;
    }
    if ((this.tree != null)) {
    if ((this.tree.getSelectedItem() == this)) {
    this.tree.setSelectedItem(null);
    }
    if ((this.contentPanel != null)) {
    this.tree.disown(this.contentPanel);
    }
    }
    this.tree = tree;

        var __child = this.children.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.setTree(tree);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    this.updateState();
    if (((tree != null)) && ((this.contentPanel != null))) {
    tree.adopt(this.contentPanel);
    }
    };
    __ui_TreeItem.prototype.__class__.setTree = function() {
        return __ui_TreeItem.prototype.setTree.call.apply(__ui_TreeItem.prototype.setTree, arguments);
    };
    __ui_TreeItem.prototype.__class__.setTree.unbound_method = true;
    __ui_TreeItem.prototype.setTree.instance_method = true;
    __ui_TreeItem.prototype.updateState = function() {
    if ((pyjslib_len(this.children) == 0)) {
    this.setVisible(this.childSpanElem, false);
    DOM_setAttribute(this.imgElem, 'src', this.imgSrc('tree_white.gif'));
    return;
    }
    if (this.open) {
    this.setVisible(this.childSpanElem, true);
    DOM_setAttribute(this.imgElem, 'src', this.imgSrc('tree_open.gif'));
    }
    else {
    this.setVisible(this.childSpanElem, false);
    DOM_setAttribute(this.imgElem, 'src', this.imgSrc('tree_closed.gif'));
    }
    };
    __ui_TreeItem.prototype.__class__.updateState = function() {
        return __ui_TreeItem.prototype.updateState.call.apply(__ui_TreeItem.prototype.updateState, arguments);
    };
    __ui_TreeItem.prototype.__class__.updateState.unbound_method = true;
    __ui_TreeItem.prototype.updateState.instance_method = true;
    __ui_TreeItem.prototype.updateStateRecursive = function() {
    this.updateState();

        var __i = pyjslib_range(pyjslib_len(this.children)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var child = this.children.__getitem__(i);
    child.updateStateRecursive();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_TreeItem.prototype.__class__.updateStateRecursive = function() {
        return __ui_TreeItem.prototype.updateStateRecursive.call.apply(__ui_TreeItem.prototype.updateStateRecursive, arguments);
    };
    __ui_TreeItem.prototype.__class__.updateStateRecursive.unbound_method = true;
    __ui_TreeItem.prototype.updateStateRecursive.instance_method = true;
}
function __ui_RootTreeItem() {
}
function ui_RootTreeItem() {
    var instance = new __ui_RootTreeItem();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_RootTreeItem_initialize() {
    if(__ui_RootTreeItem.__was_initialized__) return;
    __ui_RootTreeItem.__was_initialized__ = true;
    if(!__ui_TreeItem.__was_initialized__)
        __ui_TreeItem_initialize();
    pyjs_extend(__ui_RootTreeItem, __ui_TreeItem);
    __ui_RootTreeItem.prototype.__class__.__new__ = ui_RootTreeItem;
    __ui_RootTreeItem.prototype.addItem = function(item) {
    if (((item.getParentItem() != null)) || ((item.getTree() != null))) {
    item.remove();
    }
    item.setTree(this.getTree());
    item.setParentItem(null);
    this.children.append(item);
    DOM_setIntStyleAttribute(item.getElement(), 'marginLeft', 0);
    };
    __ui_RootTreeItem.prototype.__class__.addItem = function() {
        return __ui_RootTreeItem.prototype.addItem.call.apply(__ui_RootTreeItem.prototype.addItem, arguments);
    };
    __ui_RootTreeItem.prototype.__class__.addItem.unbound_method = true;
    __ui_RootTreeItem.prototype.addItem.instance_method = true;
    __ui_RootTreeItem.prototype.removeItem = function(item) {
    if (!this.children.__contains__(item)) {
    return;
    }
    item.setTree(null);
    item.setParentItem(null);
    this.children.remove(item);
    };
    __ui_RootTreeItem.prototype.__class__.removeItem = function() {
        return __ui_RootTreeItem.prototype.removeItem.call.apply(__ui_RootTreeItem.prototype.removeItem, arguments);
    };
    __ui_RootTreeItem.prototype.__class__.removeItem.unbound_method = true;
    __ui_RootTreeItem.prototype.removeItem.instance_method = true;
}
function __ui_Tree() {
}
function ui_Tree() {
    var instance = new __ui_Tree();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Tree_initialize() {
    if(__ui_Tree.__was_initialized__) return;
    __ui_Tree.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Tree, __ui_Widget);
    __ui_Tree.prototype.__class__.__new__ = ui_Tree;
    __ui_Tree.prototype.__init__ = function() {
    __ui_Widget.prototype.__class__.__init__(this);
    this.root = null;
    this.childWidgets = sets_Set();
    this.curSelection = null;
    this.focusable = null;
    this.focusListeners = new pyjslib_List([]);
    this.mouseListeners = new pyjslib_List([]);
    this.imageBase = pygwt_getModuleBaseURL();
    this.keyboardListeners = new pyjslib_List([]);
    this.listeners = new pyjslib_List([]);
    this.lastEventType = '';
    this.setElement(DOM_createDiv());
    DOM_setStyleAttribute(this.getElement(), 'position', 'relative');
    this.focusable = __ui_Focus.prototype.__class__.createFocusable();
    DOM_setStyleAttribute(this.focusable, 'fontSize', '0');
    DOM_setStyleAttribute(this.focusable, 'position', 'absolute');
    DOM_setIntStyleAttribute(this.focusable, 'zIndex', -1);
    DOM_appendChild(this.getElement(), this.focusable);
    this.sinkEvents((__ui_Event.prototype.__class__.MOUSEEVENTS | __ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.KEYEVENTS));
    DOM_sinkEvents(this.focusable, __ui_Event.prototype.__class__.FOCUSEVENTS);
    this.root = ui_RootTreeItem();
    this.root.setTree(this);
    this.setStyleName('gwt-Tree');
    };
    __ui_Tree.prototype.__class__.__init__ = function() {
        return __ui_Tree.prototype.__init__.call.apply(__ui_Tree.prototype.__init__, arguments);
    };
    __ui_Tree.prototype.__class__.__init__.unbound_method = true;
    __ui_Tree.prototype.__init__.instance_method = true;
    __ui_Tree.prototype.add = function(widget) {
    this.addItem(widget);
    };
    __ui_Tree.prototype.__class__.add = function() {
        return __ui_Tree.prototype.add.call.apply(__ui_Tree.prototype.add, arguments);
    };
    __ui_Tree.prototype.__class__.add.unbound_method = true;
    __ui_Tree.prototype.add.instance_method = true;
    __ui_Tree.prototype.addFocusListener = function(listener) {
    this.focusListeners.append(listener);
    };
    __ui_Tree.prototype.__class__.addFocusListener = function() {
        return __ui_Tree.prototype.addFocusListener.call.apply(__ui_Tree.prototype.addFocusListener, arguments);
    };
    __ui_Tree.prototype.__class__.addFocusListener.unbound_method = true;
    __ui_Tree.prototype.addFocusListener.instance_method = true;
    __ui_Tree.prototype.addItem = function(item) {
    if (pyjslib_isString(item)) {
    var item = ui_TreeItem(item);
    }
    var ret = this.root.addItem(item);
    DOM_appendChild(this.getElement(), item.getElement());
    return ret;
    };
    __ui_Tree.prototype.__class__.addItem = function() {
        return __ui_Tree.prototype.addItem.call.apply(__ui_Tree.prototype.addItem, arguments);
    };
    __ui_Tree.prototype.__class__.addItem.unbound_method = true;
    __ui_Tree.prototype.addItem.instance_method = true;
    __ui_Tree.prototype.addKeyboardListener = function(listener) {
    this.keyboardListeners.append(listener);
    };
    __ui_Tree.prototype.__class__.addKeyboardListener = function() {
        return __ui_Tree.prototype.addKeyboardListener.call.apply(__ui_Tree.prototype.addKeyboardListener, arguments);
    };
    __ui_Tree.prototype.__class__.addKeyboardListener.unbound_method = true;
    __ui_Tree.prototype.addKeyboardListener.instance_method = true;
    __ui_Tree.prototype.addMouseListener = function(listener) {
    this.mouseListeners.append(listener);
    };
    __ui_Tree.prototype.__class__.addMouseListener = function() {
        return __ui_Tree.prototype.addMouseListener.call.apply(__ui_Tree.prototype.addMouseListener, arguments);
    };
    __ui_Tree.prototype.__class__.addMouseListener.unbound_method = true;
    __ui_Tree.prototype.addMouseListener.instance_method = true;
    __ui_Tree.prototype.addTreeListener = function(listener) {
    this.listeners.append(listener);
    };
    __ui_Tree.prototype.__class__.addTreeListener = function() {
        return __ui_Tree.prototype.addTreeListener.call.apply(__ui_Tree.prototype.addTreeListener, arguments);
    };
    __ui_Tree.prototype.__class__.addTreeListener.unbound_method = true;
    __ui_Tree.prototype.addTreeListener.instance_method = true;
    __ui_Tree.prototype.clear = function() {
    var size = this.root.getChildCount();

        var __i = pyjslib_range(size, 0, -1).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.root.getChild( ( i - 1 ) ).remove();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Tree.prototype.__class__.clear = function() {
        return __ui_Tree.prototype.clear.call.apply(__ui_Tree.prototype.clear, arguments);
    };
    __ui_Tree.prototype.__class__.clear.unbound_method = true;
    __ui_Tree.prototype.clear.instance_method = true;
    __ui_Tree.prototype.ensureSelectedItemVisible = function() {
    if ((this.curSelection == null)) {
    return;
    }
    var parent = this.curSelection.getParentItem();
    while ((parent != null)) {
    parent.setState(true);
    var parent = parent.getParentItem();
    }
    };
    __ui_Tree.prototype.__class__.ensureSelectedItemVisible = function() {
        return __ui_Tree.prototype.ensureSelectedItemVisible.call.apply(__ui_Tree.prototype.ensureSelectedItemVisible, arguments);
    };
    __ui_Tree.prototype.__class__.ensureSelectedItemVisible.unbound_method = true;
    __ui_Tree.prototype.ensureSelectedItemVisible.instance_method = true;
    __ui_Tree.prototype.getImageBase = function() {
    return this.imageBase;
    };
    __ui_Tree.prototype.__class__.getImageBase = function() {
        return __ui_Tree.prototype.getImageBase.call.apply(__ui_Tree.prototype.getImageBase, arguments);
    };
    __ui_Tree.prototype.__class__.getImageBase.unbound_method = true;
    __ui_Tree.prototype.getImageBase.instance_method = true;
    __ui_Tree.prototype.getItem = function(index) {
    return this.root.getChild(index);
    };
    __ui_Tree.prototype.__class__.getItem = function() {
        return __ui_Tree.prototype.getItem.call.apply(__ui_Tree.prototype.getItem, arguments);
    };
    __ui_Tree.prototype.__class__.getItem.unbound_method = true;
    __ui_Tree.prototype.getItem.instance_method = true;
    __ui_Tree.prototype.getItemCount = function() {
    return this.root.getChildCount();
    };
    __ui_Tree.prototype.__class__.getItemCount = function() {
        return __ui_Tree.prototype.getItemCount.call.apply(__ui_Tree.prototype.getItemCount, arguments);
    };
    __ui_Tree.prototype.__class__.getItemCount.unbound_method = true;
    __ui_Tree.prototype.getItemCount.instance_method = true;
    __ui_Tree.prototype.getSelectedItem = function() {
    return this.curSelection;
    };
    __ui_Tree.prototype.__class__.getSelectedItem = function() {
        return __ui_Tree.prototype.getSelectedItem.call.apply(__ui_Tree.prototype.getSelectedItem, arguments);
    };
    __ui_Tree.prototype.__class__.getSelectedItem.unbound_method = true;
    __ui_Tree.prototype.getSelectedItem.instance_method = true;
    __ui_Tree.prototype.getTabIndex = function() {
    return __ui_Focus.prototype.__class__.getTabIndex(this, this.focusable);
    };
    __ui_Tree.prototype.__class__.getTabIndex = function() {
        return __ui_Tree.prototype.getTabIndex.call.apply(__ui_Tree.prototype.getTabIndex, arguments);
    };
    __ui_Tree.prototype.__class__.getTabIndex.unbound_method = true;
    __ui_Tree.prototype.getTabIndex.instance_method = true;
    __ui_Tree.prototype.__iter__ = function() {
    return this.childWidgets.__iter__();
    };
    __ui_Tree.prototype.__class__.__iter__ = function() {
        return __ui_Tree.prototype.__iter__.call.apply(__ui_Tree.prototype.__iter__, arguments);
    };
    __ui_Tree.prototype.__class__.__iter__.unbound_method = true;
    __ui_Tree.prototype.__iter__.instance_method = true;
    __ui_Tree.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    var e = DOM_eventGetTarget(event);
    if (!(this.shouldTreeDelegateFocusToElement(e))) {
    this.setFocus(true);
    }
    }
    else if ((type == 'mousedown')) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    this.elementClicked(this.root, DOM_eventGetTarget(event));
    }
    else if (((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'mouseover')) || ((type == 'mouseout'))) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    }
    else if (((type == 'blur')) || ((type == 'focus'))) {
    __ui_FocusListener.prototype.__class__.fireFocusEvent(this, this.focusListeners, this, event);
    }
    else if ((type == 'keydown')) {
    if ((this.curSelection == null)) {
    if ((this.root.getChildCount() > 0)) {
    this.onSelection(this.root.getChild(0), true);
    }
    __ui_Widget.prototype.__class__.onBrowserEvent(this, event);
    return;
    }
    if ((this.lastEventType == 'keydown')) {
    return;
    }
    var keycode = DOM_eventGetKeyCode(event);
    if ((keycode == __ui_KeyboardListener.prototype.__class__.KEY_UP)) {
    this.moveSelectionUp(this.curSelection, true);
    DOM_eventPreventDefault(event);
    }
    else if ((keycode == __ui_KeyboardListener.prototype.__class__.KEY_DOWN)) {
    this.moveSelectionDown(this.curSelection, true);
    DOM_eventPreventDefault(event);
    }
    else if ((keycode == __ui_KeyboardListener.prototype.__class__.KEY_LEFT)) {
    if (this.curSelection.getState()) {
    this.curSelection.setState(false);
    }
    DOM_eventPreventDefault(event);
    }
    else if ((keycode == __ui_KeyboardListener.prototype.__class__.KEY_RIGHT)) {
    if (!(this.curSelection.getState())) {
    this.curSelection.setState(true);
    }
    DOM_eventPreventDefault(event);
    }
    }
    else if ((type == 'keyup')) {
    if ((DOM_eventGetKeyCode(event) == __ui_KeyboardListener.prototype.__class__.KEY_TAB)) {
    var chain = new pyjslib_List([]);
    this.collectElementChain(chain, this.getElement(), DOM_eventGetTarget(event));
    var item = this.findItemByChain(chain, 0, this.root);
    if ((item != this.getSelectedItem())) {
    this.setSelectedItem(item, true);
    }
    }
    }
    else if ((type == 'keypress')) {
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent(this, this.keyboardListeners, this, event);
    }
    __ui_Widget.prototype.__class__.onBrowserEvent(this, event);
    this.lastEventType = type;
    };
    __ui_Tree.prototype.__class__.onBrowserEvent = function() {
        return __ui_Tree.prototype.onBrowserEvent.call.apply(__ui_Tree.prototype.onBrowserEvent, arguments);
    };
    __ui_Tree.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_Tree.prototype.onBrowserEvent.instance_method = true;
    __ui_Tree.prototype.remove = function(widget) {
    console.error('Widgets should never be directly removed from a tree');
    };
    __ui_Tree.prototype.__class__.remove = function() {
        return __ui_Tree.prototype.remove.call.apply(__ui_Tree.prototype.remove, arguments);
    };
    __ui_Tree.prototype.__class__.remove.unbound_method = true;
    __ui_Tree.prototype.remove.instance_method = true;
    __ui_Tree.prototype.removeFocusListener = function(listener) {
    this.focusListeners.remove(listener);
    };
    __ui_Tree.prototype.__class__.removeFocusListener = function() {
        return __ui_Tree.prototype.removeFocusListener.call.apply(__ui_Tree.prototype.removeFocusListener, arguments);
    };
    __ui_Tree.prototype.__class__.removeFocusListener.unbound_method = true;
    __ui_Tree.prototype.removeFocusListener.instance_method = true;
    __ui_Tree.prototype.removeItem = function(item) {
    this.root.removeItem(item);
    DOM_removeChild(this.getElement(), item.getElement());
    };
    __ui_Tree.prototype.__class__.removeItem = function() {
        return __ui_Tree.prototype.removeItem.call.apply(__ui_Tree.prototype.removeItem, arguments);
    };
    __ui_Tree.prototype.__class__.removeItem.unbound_method = true;
    __ui_Tree.prototype.removeItem.instance_method = true;
    __ui_Tree.prototype.removeItems = function() {
    while ((this.getItemCount() > 0)) {
    this.removeItem(this.getItem(0));
    }
    };
    __ui_Tree.prototype.__class__.removeItems = function() {
        return __ui_Tree.prototype.removeItems.call.apply(__ui_Tree.prototype.removeItems, arguments);
    };
    __ui_Tree.prototype.__class__.removeItems.unbound_method = true;
    __ui_Tree.prototype.removeItems.instance_method = true;
    __ui_Tree.prototype.removeKeyboardListener = function(listener) {
    this.keyboardListeners.remove(listener);
    };
    __ui_Tree.prototype.__class__.removeKeyboardListener = function() {
        return __ui_Tree.prototype.removeKeyboardListener.call.apply(__ui_Tree.prototype.removeKeyboardListener, arguments);
    };
    __ui_Tree.prototype.__class__.removeKeyboardListener.unbound_method = true;
    __ui_Tree.prototype.removeKeyboardListener.instance_method = true;
    __ui_Tree.prototype.removeTreeListener = function(listener) {
    this.listeners.remove(listener);
    };
    __ui_Tree.prototype.__class__.removeTreeListener = function() {
        return __ui_Tree.prototype.removeTreeListener.call.apply(__ui_Tree.prototype.removeTreeListener, arguments);
    };
    __ui_Tree.prototype.__class__.removeTreeListener.unbound_method = true;
    __ui_Tree.prototype.removeTreeListener.instance_method = true;
    __ui_Tree.prototype.setAccessKey = function(key) {
    __ui_Focus.prototype.__class__.setAccessKey(this, this.focusable, key);
    };
    __ui_Tree.prototype.__class__.setAccessKey = function() {
        return __ui_Tree.prototype.setAccessKey.call.apply(__ui_Tree.prototype.setAccessKey, arguments);
    };
    __ui_Tree.prototype.__class__.setAccessKey.unbound_method = true;
    __ui_Tree.prototype.setAccessKey.instance_method = true;
    __ui_Tree.prototype.setFocus = function(focus) {
    if (focus) {
    __ui_Focus.prototype.__class__.focus(this, this.focusable);
    }
    else {
    __ui_Focus.prototype.__class__.blur(this, this.focusable);
    }
    };
    __ui_Tree.prototype.__class__.setFocus = function() {
        return __ui_Tree.prototype.setFocus.call.apply(__ui_Tree.prototype.setFocus, arguments);
    };
    __ui_Tree.prototype.__class__.setFocus.unbound_method = true;
    __ui_Tree.prototype.setFocus.instance_method = true;
    __ui_Tree.prototype.setImageBase = function(baseUrl) {
    this.imageBase = baseUrl;
    this.root.updateStateRecursive();
    };
    __ui_Tree.prototype.__class__.setImageBase = function() {
        return __ui_Tree.prototype.setImageBase.call.apply(__ui_Tree.prototype.setImageBase, arguments);
    };
    __ui_Tree.prototype.__class__.setImageBase.unbound_method = true;
    __ui_Tree.prototype.setImageBase.instance_method = true;
    __ui_Tree.prototype.setSelectedItem = function(item, fireEvents) {
    if (typeof fireEvents == 'undefined') fireEvents=true;
    if ((item == null)) {
    if ((this.curSelection == null)) {
    return;
    }
    this.curSelection.setSelected(false);
    this.curSelection = null;
    return;
    }
    this.onSelection(item, fireEvents);
    };
__ui_Tree.prototype.setSelectedItem.parse_kwargs = function ( __kwargs, item, fireEvents ) {
    if (typeof fireEvents == 'undefined')
        fireEvents=__kwargs.fireEvents;
    var __r = [item, fireEvents];
    return __r;
};
    __ui_Tree.prototype.__class__.setSelectedItem = function() {
        return __ui_Tree.prototype.setSelectedItem.call.apply(__ui_Tree.prototype.setSelectedItem, arguments);
    };
    __ui_Tree.prototype.__class__.setSelectedItem.unbound_method = true;
    __ui_Tree.prototype.setSelectedItem.instance_method = true;
    __ui_Tree.prototype.__class__.setSelectedItem.parse_kwargs = __ui_Tree.prototype.setSelectedItem.parse_kwargs;
    __ui_Tree.prototype.setTabIndex = function(index) {
    __ui_Focus.prototype.__class__.setTabIndex(this, this.focusable, index);
    };
    __ui_Tree.prototype.__class__.setTabIndex = function() {
        return __ui_Tree.prototype.setTabIndex.call.apply(__ui_Tree.prototype.setTabIndex, arguments);
    };
    __ui_Tree.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_Tree.prototype.setTabIndex.instance_method = true;
    __ui_Tree.prototype.treeItemIterator = function() {
    var accum = new pyjslib_List([]);
    this.root.addTreeItems(accum);
    return accum.__iter__();
    };
    __ui_Tree.prototype.__class__.treeItemIterator = function() {
        return __ui_Tree.prototype.treeItemIterator.call.apply(__ui_Tree.prototype.treeItemIterator, arguments);
    };
    __ui_Tree.prototype.__class__.treeItemIterator.unbound_method = true;
    __ui_Tree.prototype.treeItemIterator.instance_method = true;
    __ui_Tree.prototype.collectElementChain = function(chain, hRoot, hElem) {
    if (((hElem == null)) || (DOM_compare(hElem, hRoot))) {
    return;
    }
    this.collectElementChain(chain, hRoot, DOM_getParent(hElem));
    chain.append(hElem);
    };
    __ui_Tree.prototype.__class__.collectElementChain = function() {
        return __ui_Tree.prototype.collectElementChain.call.apply(__ui_Tree.prototype.collectElementChain, arguments);
    };
    __ui_Tree.prototype.__class__.collectElementChain.unbound_method = true;
    __ui_Tree.prototype.collectElementChain.instance_method = true;
    __ui_Tree.prototype.elementClicked = function(root, hElem) {
    var chain = new pyjslib_List([]);
    this.collectElementChain(chain, this.getElement(), hElem);
    var item = this.findItemByChain(chain, 0, root);
    if ((item != null)) {
    if (DOM_compare(item.getImageElement(), hElem)) {
    item.setState(!(item.getState()), true);
    return true;
    }
    else if (DOM_isOrHasChild(item.getElement(), hElem)) {
    this.onSelection(item, true);
    return true;
    }
    }
    return false;
    };
    __ui_Tree.prototype.__class__.elementClicked = function() {
        return __ui_Tree.prototype.elementClicked.call.apply(__ui_Tree.prototype.elementClicked, arguments);
    };
    __ui_Tree.prototype.__class__.elementClicked.unbound_method = true;
    __ui_Tree.prototype.elementClicked.instance_method = true;
    __ui_Tree.prototype.findDeepestOpenChild = function(item) {
    if (!(item.getState())) {
    return item;
    }
    return this.findDeepestOpenChild(item.getChild( ( item.getChildCount() - 1 ) ));
    };
    __ui_Tree.prototype.__class__.findDeepestOpenChild = function() {
        return __ui_Tree.prototype.findDeepestOpenChild.call.apply(__ui_Tree.prototype.findDeepestOpenChild, arguments);
    };
    __ui_Tree.prototype.__class__.findDeepestOpenChild.unbound_method = true;
    __ui_Tree.prototype.findDeepestOpenChild.instance_method = true;
    __ui_Tree.prototype.findItemByChain = function(chain, idx, root) {
    if ((idx == pyjslib_len(chain))) {
    return root;
    }
    var hCurElem = chain.__getitem__(idx);

        var __i = pyjslib_range(root.getChildCount()).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var child = root.getChild(i);
    if (DOM_compare(child.getElement(), hCurElem)) {
    var retItem = this.findItemByChain(chain,  ( idx + 1 ) , root.getChild(i));
    if ((retItem == null)) {
    return child;
    }
    return retItem;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return this.findItemByChain(chain,  ( idx + 1 ) , root);
    };
    __ui_Tree.prototype.__class__.findItemByChain = function() {
        return __ui_Tree.prototype.findItemByChain.call.apply(__ui_Tree.prototype.findItemByChain, arguments);
    };
    __ui_Tree.prototype.__class__.findItemByChain.unbound_method = true;
    __ui_Tree.prototype.findItemByChain.instance_method = true;
    __ui_Tree.prototype.moveFocus = function(selection) {
    var focusableWidget = selection.getFocusableWidget();
    if ((focusableWidget != null)) {
    focusableWidget.setFocus(true);
    DOM_scrollIntoView(focusableWidget.getElement());
    }
    else {
    var selectedElem = selection.getContentElem();
    var containerLeft = this.getAbsoluteLeft();
    var containerTop = this.getAbsoluteTop();
    var left =  ( DOM_getAbsoluteLeft(selectedElem) - containerLeft ) ;
    var top =  ( DOM_getAbsoluteTop(selectedElem) - containerTop ) ;
    var width = DOM_getIntAttribute(selectedElem, 'offsetWidth');
    var height = DOM_getIntAttribute(selectedElem, 'offsetHeight');
    DOM_setIntStyleAttribute(this.focusable, 'left', left);
    DOM_setIntStyleAttribute(this.focusable, 'top', top);
    DOM_setIntStyleAttribute(this.focusable, 'width', width);
    DOM_setIntStyleAttribute(this.focusable, 'height', height);
    DOM_scrollIntoView(this.focusable);
    __ui_Focus.prototype.__class__.focus(this, this.focusable);
    }
    };
    __ui_Tree.prototype.__class__.moveFocus = function() {
        return __ui_Tree.prototype.moveFocus.call.apply(__ui_Tree.prototype.moveFocus, arguments);
    };
    __ui_Tree.prototype.__class__.moveFocus.unbound_method = true;
    __ui_Tree.prototype.moveFocus.instance_method = true;
    __ui_Tree.prototype.moveSelectionDown = function(sel, dig) {
    if ((sel == this.root)) {
    return;
    }
    var parent = sel.getParentItem();
    if ((parent == null)) {
    var parent = this.root;
    }
    var idx = parent.getChildIndex(sel);
    if ((!(dig)) || (!(sel.getState()))) {
    if ((idx <  ( parent.getChildCount() - 1 ) )) {
    this.onSelection(parent.getChild( ( idx + 1 ) ), true);
    }
    else {
    this.moveSelectionDown(parent, false);
    }
    }
    else if ((sel.getChildCount() > 0)) {
    this.onSelection(sel.getChild(0), true);
    }
    };
    __ui_Tree.prototype.__class__.moveSelectionDown = function() {
        return __ui_Tree.prototype.moveSelectionDown.call.apply(__ui_Tree.prototype.moveSelectionDown, arguments);
    };
    __ui_Tree.prototype.__class__.moveSelectionDown.unbound_method = true;
    __ui_Tree.prototype.moveSelectionDown.instance_method = true;
    __ui_Tree.prototype.moveSelectionUp = function(sel, climb) {
    var parent = sel.getParentItem();
    if ((parent == null)) {
    var parent = this.root;
    }
    var idx = parent.getChildIndex(sel);
    if ((idx > 0)) {
    var sibling = parent.getChild( ( idx - 1 ) );
    this.onSelection(this.findDeepestOpenChild(sibling), true);
    }
    else {
    this.onSelection(parent, true);
    }
    };
    __ui_Tree.prototype.__class__.moveSelectionUp = function() {
        return __ui_Tree.prototype.moveSelectionUp.call.apply(__ui_Tree.prototype.moveSelectionUp, arguments);
    };
    __ui_Tree.prototype.__class__.moveSelectionUp.unbound_method = true;
    __ui_Tree.prototype.moveSelectionUp.instance_method = true;
    __ui_Tree.prototype.onSelection = function(item, fireEvents) {
    if ((item == this.root)) {
    return;
    }
    if ((this.curSelection != null)) {
    this.curSelection.setSelected(false);
    }
    this.curSelection = item;
    if ((this.curSelection != null)) {
    this.moveFocus(this.curSelection);
    this.curSelection.setSelected(true);
    if ((fireEvents) && (pyjslib_len(this.listeners))) {

        var __listener = this.listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onTreeItemSelected(item);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    }
    };
    __ui_Tree.prototype.__class__.onSelection = function() {
        return __ui_Tree.prototype.onSelection.call.apply(__ui_Tree.prototype.onSelection, arguments);
    };
    __ui_Tree.prototype.__class__.onSelection.unbound_method = true;
    __ui_Tree.prototype.onSelection.instance_method = true;
    __ui_Tree.prototype.doAttachChildren = function() {

        var __child = this.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.onAttach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    DOM_setEventListener(this.focusable, this);
    };
    __ui_Tree.prototype.__class__.doAttachChildren = function() {
        return __ui_Tree.prototype.doAttachChildren.call.apply(__ui_Tree.prototype.doAttachChildren, arguments);
    };
    __ui_Tree.prototype.__class__.doAttachChildren.unbound_method = true;
    __ui_Tree.prototype.doAttachChildren.instance_method = true;
    __ui_Tree.prototype.doDetachChildren = function() {

        var __child = this.__iter__();
        try {
            while (true) {
                var child = __child.next();
                
        
    child.onDetach();

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    DOM_setEventListener(this.focusable, null);
    };
    __ui_Tree.prototype.__class__.doDetachChildren = function() {
        return __ui_Tree.prototype.doDetachChildren.call.apply(__ui_Tree.prototype.doDetachChildren, arguments);
    };
    __ui_Tree.prototype.__class__.doDetachChildren.unbound_method = true;
    __ui_Tree.prototype.doDetachChildren.instance_method = true;
    __ui_Tree.prototype.onLoad = function() {
    this.root.updateStateRecursive();
    };
    __ui_Tree.prototype.__class__.onLoad = function() {
        return __ui_Tree.prototype.onLoad.call.apply(__ui_Tree.prototype.onLoad, arguments);
    };
    __ui_Tree.prototype.__class__.onLoad.unbound_method = true;
    __ui_Tree.prototype.onLoad.instance_method = true;
    __ui_Tree.prototype.adopt = function(content) {
    this.childWidgets.add(content);
    content.treeSetParent(this);
    };
    __ui_Tree.prototype.__class__.adopt = function() {
        return __ui_Tree.prototype.adopt.call.apply(__ui_Tree.prototype.adopt, arguments);
    };
    __ui_Tree.prototype.__class__.adopt.unbound_method = true;
    __ui_Tree.prototype.adopt.instance_method = true;
    __ui_Tree.prototype.disown = function(item) {
    this.childWidgets.remove(item);
    item.treeSetParent(null);
    };
    __ui_Tree.prototype.__class__.disown = function() {
        return __ui_Tree.prototype.disown.call.apply(__ui_Tree.prototype.disown, arguments);
    };
    __ui_Tree.prototype.__class__.disown.unbound_method = true;
    __ui_Tree.prototype.disown.instance_method = true;
    __ui_Tree.prototype.fireStateChanged = function(item) {

        var __listener = this.listeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (pyjslib_hasattr(listener, 'onTreeItemStateChanged')) {
    listener.onTreeItemStateChanged(item);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_Tree.prototype.__class__.fireStateChanged = function() {
        return __ui_Tree.prototype.fireStateChanged.call.apply(__ui_Tree.prototype.fireStateChanged, arguments);
    };
    __ui_Tree.prototype.__class__.fireStateChanged.unbound_method = true;
    __ui_Tree.prototype.fireStateChanged.instance_method = true;
    __ui_Tree.prototype.getChildWidgets = function() {
    return this.childWidgets;
    };
    __ui_Tree.prototype.__class__.getChildWidgets = function() {
        return __ui_Tree.prototype.getChildWidgets.call.apply(__ui_Tree.prototype.getChildWidgets, arguments);
    };
    __ui_Tree.prototype.__class__.getChildWidgets.unbound_method = true;
    __ui_Tree.prototype.getChildWidgets.instance_method = true;
    __ui_Tree.prototype.shouldTreeDelegateFocusToElement = function(elem) {

        var focus = ((elem.nodeName == "SELECT") || (elem.nodeName == "INPUT")  || (elem.nodeName == "CHECKBOX"));
        return focus;
        
    };
    __ui_Tree.prototype.__class__.shouldTreeDelegateFocusToElement = function() {
        return __ui_Tree.prototype.shouldTreeDelegateFocusToElement.call.apply(__ui_Tree.prototype.shouldTreeDelegateFocusToElement, arguments);
    };
    __ui_Tree.prototype.__class__.shouldTreeDelegateFocusToElement.unbound_method = true;
    __ui_Tree.prototype.shouldTreeDelegateFocusToElement.instance_method = true;
}
function __ui_FocusPanel() {
}
function ui_FocusPanel(child) {
    if (typeof child == 'undefined') child=null;
    var instance = new __ui_FocusPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_FocusPanel.parse_kwargs = function ( __kwargs, child ) {
    if (typeof child == 'undefined')
        child=__kwargs.child;
    var __r = [child];
    return __r;
};
function __ui_FocusPanel_initialize() {
    if(__ui_FocusPanel.__was_initialized__) return;
    __ui_FocusPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_FocusPanel, __ui_SimplePanel);
    __ui_FocusPanel.prototype.__class__.__new__ = ui_FocusPanel;
    __ui_FocusPanel.prototype.__init__ = function(child) {
    if (typeof child == 'undefined') child=null;
    this.clickListeners = new pyjslib_List([]);
    this.focusListeners = new pyjslib_List([]);
    this.keyboardListeners = new pyjslib_List([]);
    this.mouseListeners = new pyjslib_List([]);
    __ui_SimplePanel.prototype.__class__.__init__(this, __ui_Focus.prototype.__class__.createFocusable(this));
    this.sinkEvents((__ui_Event.prototype.__class__.FOCUSEVENTS | __ui_Event.prototype.__class__.KEYEVENTS | __ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.MOUSEEVENTS));
    if (child) {
    this.setWidget(child);
    }
    };
__ui_FocusPanel.prototype.__init__.parse_kwargs = function ( __kwargs, child ) {
    if (typeof child == 'undefined')
        child=__kwargs.child;
    var __r = [child];
    return __r;
};
    __ui_FocusPanel.prototype.__class__.__init__ = function() {
        return __ui_FocusPanel.prototype.__init__.call.apply(__ui_FocusPanel.prototype.__init__, arguments);
    };
    __ui_FocusPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_FocusPanel.prototype.__init__.instance_method = true;
    __ui_FocusPanel.prototype.__class__.__init__.parse_kwargs = __ui_FocusPanel.prototype.__init__.parse_kwargs;
    __ui_FocusPanel.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __ui_FocusPanel.prototype.__class__.addClickListener = function() {
        return __ui_FocusPanel.prototype.addClickListener.call.apply(__ui_FocusPanel.prototype.addClickListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.addClickListener.unbound_method = true;
    __ui_FocusPanel.prototype.addClickListener.instance_method = true;
    __ui_FocusPanel.prototype.addFocusListener = function(listener) {
    this.focusListeners.append(listener);
    };
    __ui_FocusPanel.prototype.__class__.addFocusListener = function() {
        return __ui_FocusPanel.prototype.addFocusListener.call.apply(__ui_FocusPanel.prototype.addFocusListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.addFocusListener.unbound_method = true;
    __ui_FocusPanel.prototype.addFocusListener.instance_method = true;
    __ui_FocusPanel.prototype.addKeyboardListener = function(listener) {
    this.keyboardListeners.append(listener);
    };
    __ui_FocusPanel.prototype.__class__.addKeyboardListener = function() {
        return __ui_FocusPanel.prototype.addKeyboardListener.call.apply(__ui_FocusPanel.prototype.addKeyboardListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.addKeyboardListener.unbound_method = true;
    __ui_FocusPanel.prototype.addKeyboardListener.instance_method = true;
    __ui_FocusPanel.prototype.addMouseListener = function(listener) {
    this.mouseListeners.append(listener);
    };
    __ui_FocusPanel.prototype.__class__.addMouseListener = function() {
        return __ui_FocusPanel.prototype.addMouseListener.call.apply(__ui_FocusPanel.prototype.addMouseListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.addMouseListener.unbound_method = true;
    __ui_FocusPanel.prototype.addMouseListener.instance_method = true;
    __ui_FocusPanel.prototype.getTabIndex = function() {
    return __ui_Focus.prototype.__class__.getTabIndex(this, this.getElement());
    };
    __ui_FocusPanel.prototype.__class__.getTabIndex = function() {
        return __ui_FocusPanel.prototype.getTabIndex.call.apply(__ui_FocusPanel.prototype.getTabIndex, arguments);
    };
    __ui_FocusPanel.prototype.__class__.getTabIndex.unbound_method = true;
    __ui_FocusPanel.prototype.getTabIndex.instance_method = true;
    __ui_FocusPanel.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onClick) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if (((type == 'mousedown')) || ((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'mouseover')) || ((type == 'mouseout'))) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    }
    else if (((type == 'blur')) || ((type == 'focus'))) {
    __ui_FocusListener.prototype.__class__.fireFocusEvent(this, this.focusListeners, this, event);
    }
    else if (((type == 'keydown')) || ((type == 'keypress')) || ((type == 'keyup'))) {
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent(this, this.keyboardListeners, this, event);
    }
    };
    __ui_FocusPanel.prototype.__class__.onBrowserEvent = function() {
        return __ui_FocusPanel.prototype.onBrowserEvent.call.apply(__ui_FocusPanel.prototype.onBrowserEvent, arguments);
    };
    __ui_FocusPanel.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_FocusPanel.prototype.onBrowserEvent.instance_method = true;
    __ui_FocusPanel.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __ui_FocusPanel.prototype.__class__.removeClickListener = function() {
        return __ui_FocusPanel.prototype.removeClickListener.call.apply(__ui_FocusPanel.prototype.removeClickListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.removeClickListener.unbound_method = true;
    __ui_FocusPanel.prototype.removeClickListener.instance_method = true;
    __ui_FocusPanel.prototype.removeFocusListener = function(listener) {
    this.focusListeners.remove(listener);
    };
    __ui_FocusPanel.prototype.__class__.removeFocusListener = function() {
        return __ui_FocusPanel.prototype.removeFocusListener.call.apply(__ui_FocusPanel.prototype.removeFocusListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.removeFocusListener.unbound_method = true;
    __ui_FocusPanel.prototype.removeFocusListener.instance_method = true;
    __ui_FocusPanel.prototype.removeKeyboardListener = function(listener) {
    this.keyboardListeners.remove(listener);
    };
    __ui_FocusPanel.prototype.__class__.removeKeyboardListener = function() {
        return __ui_FocusPanel.prototype.removeKeyboardListener.call.apply(__ui_FocusPanel.prototype.removeKeyboardListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.removeKeyboardListener.unbound_method = true;
    __ui_FocusPanel.prototype.removeKeyboardListener.instance_method = true;
    __ui_FocusPanel.prototype.removeMouseListener = function(listener) {
    this.mouseListeners.remove(listener);
    };
    __ui_FocusPanel.prototype.__class__.removeMouseListener = function() {
        return __ui_FocusPanel.prototype.removeMouseListener.call.apply(__ui_FocusPanel.prototype.removeMouseListener, arguments);
    };
    __ui_FocusPanel.prototype.__class__.removeMouseListener.unbound_method = true;
    __ui_FocusPanel.prototype.removeMouseListener.instance_method = true;
    __ui_FocusPanel.prototype.setAccessKey = function(key) {
    __ui_Focus.prototype.__class__.setAccessKey(this, this.getElement(), key);
    };
    __ui_FocusPanel.prototype.__class__.setAccessKey = function() {
        return __ui_FocusPanel.prototype.setAccessKey.call.apply(__ui_FocusPanel.prototype.setAccessKey, arguments);
    };
    __ui_FocusPanel.prototype.__class__.setAccessKey.unbound_method = true;
    __ui_FocusPanel.prototype.setAccessKey.instance_method = true;
    __ui_FocusPanel.prototype.setFocus = function(focused) {
    if (focused) {
    __ui_Focus.prototype.__class__.focus(this, this.getElement());
    }
    else {
    __ui_Focus.prototype.__class__.blur(this, this.getElement());
    }
    };
    __ui_FocusPanel.prototype.__class__.setFocus = function() {
        return __ui_FocusPanel.prototype.setFocus.call.apply(__ui_FocusPanel.prototype.setFocus, arguments);
    };
    __ui_FocusPanel.prototype.__class__.setFocus.unbound_method = true;
    __ui_FocusPanel.prototype.setFocus.instance_method = true;
    __ui_FocusPanel.prototype.setTabIndex = function(index) {
    __ui_Focus.prototype.__class__.setTabIndex(this, this.getElement(), index);
    };
    __ui_FocusPanel.prototype.__class__.setTabIndex = function() {
        return __ui_FocusPanel.prototype.setTabIndex.call.apply(__ui_FocusPanel.prototype.setTabIndex, arguments);
    };
    __ui_FocusPanel.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_FocusPanel.prototype.setTabIndex.instance_method = true;
}
function __ui_Focus() {
}
function ui_Focus() {
    var instance = new __ui_Focus();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_Focus_initialize() {
    if(__ui_Focus.__was_initialized__) return;
    __ui_Focus.__was_initialized__ = true;
    pyjs_extend(__ui_Focus, __pyjslib_Object);
    __ui_Focus.prototype.__class__.__new__ = ui_Focus;
    __ui_Focus.prototype.blur = function(elem) {

        elem.firstChild.blur();
        
    };
    __ui_Focus.prototype.__class__.blur = function() {
        return __ui_Focus.prototype.blur.call.apply(__ui_Focus.prototype.blur, arguments);
    };
    __ui_Focus.prototype.__class__.blur.unbound_method = true;
    __ui_Focus.prototype.blur.instance_method = true;
    __ui_Focus.prototype.createFocusable = function() {

        var div = $doc.createElement('div');
        var input = $doc.createElement('input');
        input.type = 'text';
        input.style.width = input.style.height = 0;
        input.style.zIndex = -1;
        input.style.position = 'absolute';

        input.addEventListener(
            'blur',
            function(evt) { if (this.parentNode.onblur) this.parentNode.onblur(evt); },
            false);

        input.addEventListener(
            'focus',
            function(evt) { if (this.parentNode.onfocus) this.parentNode.onfocus(evt); },
            false);

        div.addEventListener(
            'mousedown',
            function(evt) { this.firstChild.focus(); },
            false);
        
        div.appendChild(input);
        return div;
        
    };
    __ui_Focus.prototype.__class__.createFocusable = function() {
        return __ui_Focus.prototype.createFocusable.call.apply(__ui_Focus.prototype.createFocusable, arguments);
    };
    __ui_Focus.prototype.__class__.createFocusable.unbound_method = true;
    __ui_Focus.prototype.createFocusable.instance_method = true;
    __ui_Focus.prototype.focus = function(elem) {

        elem.firstChild.focus();
        
    };
    __ui_Focus.prototype.__class__.focus = function() {
        return __ui_Focus.prototype.focus.call.apply(__ui_Focus.prototype.focus, arguments);
    };
    __ui_Focus.prototype.__class__.focus.unbound_method = true;
    __ui_Focus.prototype.focus.instance_method = true;
    __ui_Focus.prototype.getTabIndex = function(elem) {

        return elem.firstChild.tabIndex;
        
    };
    __ui_Focus.prototype.__class__.getTabIndex = function() {
        return __ui_Focus.prototype.getTabIndex.call.apply(__ui_Focus.prototype.getTabIndex, arguments);
    };
    __ui_Focus.prototype.__class__.getTabIndex.unbound_method = true;
    __ui_Focus.prototype.getTabIndex.instance_method = true;
    __ui_Focus.prototype.setAccessKey = function(elem, key) {

        elem.firstChild.accessKey = key;
        
    };
    __ui_Focus.prototype.__class__.setAccessKey = function() {
        return __ui_Focus.prototype.setAccessKey.call.apply(__ui_Focus.prototype.setAccessKey, arguments);
    };
    __ui_Focus.prototype.__class__.setAccessKey.unbound_method = true;
    __ui_Focus.prototype.setAccessKey.instance_method = true;
    __ui_Focus.prototype.setTabIndex = function(elem, index) {

        elem.firstChild.tabIndex = index;
        
    };
    __ui_Focus.prototype.__class__.setTabIndex = function() {
        return __ui_Focus.prototype.setTabIndex.call.apply(__ui_Focus.prototype.setTabIndex, arguments);
    };
    __ui_Focus.prototype.__class__.setTabIndex.unbound_method = true;
    __ui_Focus.prototype.setTabIndex.instance_method = true;
}
function __ui_FileUpload() {
}
function ui_FileUpload() {
    var instance = new __ui_FileUpload();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FileUpload_initialize() {
    if(__ui_FileUpload.__was_initialized__) return;
    __ui_FileUpload.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_FileUpload, __ui_Widget);
    __ui_FileUpload.prototype.__class__.__new__ = ui_FileUpload;
    __ui_FileUpload.prototype.__init__ = function() {
    __ui_Widget.prototype.__class__.__init__(this);
    this.setElement(DOM_createElement('input'));
    DOM_setAttribute(this.getElement(), 'type', 'file');
    this.setStyleName('gwt-FileUpload');
    };
    __ui_FileUpload.prototype.__class__.__init__ = function() {
        return __ui_FileUpload.prototype.__init__.call.apply(__ui_FileUpload.prototype.__init__, arguments);
    };
    __ui_FileUpload.prototype.__class__.__init__.unbound_method = true;
    __ui_FileUpload.prototype.__init__.instance_method = true;
    __ui_FileUpload.prototype.getFilename = function() {
    return DOM_getAttribute(this.getElement(), 'value');
    };
    __ui_FileUpload.prototype.__class__.getFilename = function() {
        return __ui_FileUpload.prototype.getFilename.call.apply(__ui_FileUpload.prototype.getFilename, arguments);
    };
    __ui_FileUpload.prototype.__class__.getFilename.unbound_method = true;
    __ui_FileUpload.prototype.getFilename.instance_method = true;
    __ui_FileUpload.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_FileUpload.prototype.__class__.getName = function() {
        return __ui_FileUpload.prototype.getName.call.apply(__ui_FileUpload.prototype.getName, arguments);
    };
    __ui_FileUpload.prototype.__class__.getName.unbound_method = true;
    __ui_FileUpload.prototype.getName.instance_method = true;
    __ui_FileUpload.prototype.setName = function(name) {
    DOM_setAttribute(this.getElement(), 'name', name);
    };
    __ui_FileUpload.prototype.__class__.setName = function() {
        return __ui_FileUpload.prototype.setName.call.apply(__ui_FileUpload.prototype.setName, arguments);
    };
    __ui_FileUpload.prototype.__class__.setName.unbound_method = true;
    __ui_FileUpload.prototype.setName.instance_method = true;
}
function __ui_Hidden() {
}
function ui_Hidden(name, value) {
    if (typeof name == 'undefined') name=null;
    if (typeof value == 'undefined') value=null;
    var instance = new __ui_Hidden();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_Hidden.parse_kwargs = function ( __kwargs, name, value ) {
    if (typeof name == 'undefined')
        name=__kwargs.name;
    if (typeof value == 'undefined')
        value=__kwargs.value;
    var __r = [name, value];
    return __r;
};
function __ui_Hidden_initialize() {
    if(__ui_Hidden.__was_initialized__) return;
    __ui_Hidden.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_Hidden, __ui_Widget);
    __ui_Hidden.prototype.__class__.__new__ = ui_Hidden;
    __ui_Hidden.prototype.__init__ = function(name, value) {
    if (typeof name == 'undefined') name=null;
    if (typeof value == 'undefined') value=null;
    __ui_Widget.prototype.__class__.__init__(this);
    var element = DOM_createElement('input');
    this.setElement(element);
    DOM_setAttribute(element, 'type', 'hidden');
    if ((name != null)) {
    this.setName(name);
    }
    if ((value != null)) {
    this.setValue(value);
    }
    };
__ui_Hidden.prototype.__init__.parse_kwargs = function ( __kwargs, name, value ) {
    if (typeof name == 'undefined')
        name=__kwargs.name;
    if (typeof value == 'undefined')
        value=__kwargs.value;
    var __r = [name, value];
    return __r;
};
    __ui_Hidden.prototype.__class__.__init__ = function() {
        return __ui_Hidden.prototype.__init__.call.apply(__ui_Hidden.prototype.__init__, arguments);
    };
    __ui_Hidden.prototype.__class__.__init__.unbound_method = true;
    __ui_Hidden.prototype.__init__.instance_method = true;
    __ui_Hidden.prototype.__class__.__init__.parse_kwargs = __ui_Hidden.prototype.__init__.parse_kwargs;
    __ui_Hidden.prototype.getDefaultValue = function() {
    return DOM_getAttribute(this.getElement(), 'defaultValue');
    };
    __ui_Hidden.prototype.__class__.getDefaultValue = function() {
        return __ui_Hidden.prototype.getDefaultValue.call.apply(__ui_Hidden.prototype.getDefaultValue, arguments);
    };
    __ui_Hidden.prototype.__class__.getDefaultValue.unbound_method = true;
    __ui_Hidden.prototype.getDefaultValue.instance_method = true;
    __ui_Hidden.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_Hidden.prototype.__class__.getName = function() {
        return __ui_Hidden.prototype.getName.call.apply(__ui_Hidden.prototype.getName, arguments);
    };
    __ui_Hidden.prototype.__class__.getName.unbound_method = true;
    __ui_Hidden.prototype.getName.instance_method = true;
    __ui_Hidden.prototype.getValue = function() {
    return DOM_getAttribute(this.getElement(), 'value');
    };
    __ui_Hidden.prototype.__class__.getValue = function() {
        return __ui_Hidden.prototype.getValue.call.apply(__ui_Hidden.prototype.getValue, arguments);
    };
    __ui_Hidden.prototype.__class__.getValue.unbound_method = true;
    __ui_Hidden.prototype.getValue.instance_method = true;
    __ui_Hidden.prototype.setDefaultValue = function(defaultValue) {
    DOM_setAttribute(this.getElement(), 'defaultValue', defaultValue);
    };
    __ui_Hidden.prototype.__class__.setDefaultValue = function() {
        return __ui_Hidden.prototype.setDefaultValue.call.apply(__ui_Hidden.prototype.setDefaultValue, arguments);
    };
    __ui_Hidden.prototype.__class__.setDefaultValue.unbound_method = true;
    __ui_Hidden.prototype.setDefaultValue.instance_method = true;
    __ui_Hidden.prototype.setName = function(name) {
    if ((name == null)) {
    console.error('Name cannot be null');
    }
    else if ((pyjslib_len(name) == 0)) {
    console.error('Name cannot be an empty string.');
    }
    DOM_setAttribute(this.getElement(), 'name', name);
    };
    __ui_Hidden.prototype.__class__.setName = function() {
        return __ui_Hidden.prototype.setName.call.apply(__ui_Hidden.prototype.setName, arguments);
    };
    __ui_Hidden.prototype.__class__.setName.unbound_method = true;
    __ui_Hidden.prototype.setName.instance_method = true;
    __ui_Hidden.prototype.setValue = function(value) {
    DOM_setAttribute(this.getElement(), 'value', value);
    };
    __ui_Hidden.prototype.__class__.setValue = function() {
        return __ui_Hidden.prototype.setValue.call.apply(__ui_Hidden.prototype.setValue, arguments);
    };
    __ui_Hidden.prototype.__class__.setValue.unbound_method = true;
    __ui_Hidden.prototype.setValue.instance_method = true;
}
function __ui_NamedFrame() {
}
function ui_NamedFrame(name) {
    var instance = new __ui_NamedFrame();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_NamedFrame_initialize() {
    if(__ui_NamedFrame.__was_initialized__) return;
    __ui_NamedFrame.__was_initialized__ = true;
    if(!__ui_Frame.__was_initialized__)
        __ui_Frame_initialize();
    pyjs_extend(__ui_NamedFrame, __ui_Frame);
    __ui_NamedFrame.prototype.__class__.__new__ = ui_NamedFrame;
    __ui_NamedFrame.prototype.__init__ = function(name) {
    __ui_Frame.prototype.__class__.__init__(this);
    var div = DOM_createDiv();
    DOM_setInnerHTML(div,  (  ( '<iframe name=\'' + name )  + '\'>' ) );
    var iframe = DOM_getFirstChild(div);
    this.setElement(iframe);
    };
    __ui_NamedFrame.prototype.__class__.__init__ = function() {
        return __ui_NamedFrame.prototype.__init__.call.apply(__ui_NamedFrame.prototype.__init__, arguments);
    };
    __ui_NamedFrame.prototype.__class__.__init__.unbound_method = true;
    __ui_NamedFrame.prototype.__init__.instance_method = true;
    __ui_NamedFrame.prototype.getName = function() {
    return DOM_getAttribute(this.getElement(), 'name');
    };
    __ui_NamedFrame.prototype.__class__.getName = function() {
        return __ui_NamedFrame.prototype.getName.call.apply(__ui_NamedFrame.prototype.getName, arguments);
    };
    __ui_NamedFrame.prototype.__class__.getName.unbound_method = true;
    __ui_NamedFrame.prototype.getName.instance_method = true;
}
function __ui_EventObject() {
}
function ui_EventObject(source) {
    var instance = new __ui_EventObject();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_EventObject_initialize() {
    if(__ui_EventObject.__was_initialized__) return;
    __ui_EventObject.__was_initialized__ = true;
    pyjs_extend(__ui_EventObject, __pyjslib_Object);
    __ui_EventObject.prototype.__class__.__new__ = ui_EventObject;
    __ui_EventObject.prototype.__init__ = function(source) {
    this.source = source;
    };
    __ui_EventObject.prototype.__class__.__init__ = function() {
        return __ui_EventObject.prototype.__init__.call.apply(__ui_EventObject.prototype.__init__, arguments);
    };
    __ui_EventObject.prototype.__class__.__init__.unbound_method = true;
    __ui_EventObject.prototype.__init__.instance_method = true;
    __ui_EventObject.prototype.getSource = function() {
    return this.source;
    };
    __ui_EventObject.prototype.__class__.getSource = function() {
        return __ui_EventObject.prototype.getSource.call.apply(__ui_EventObject.prototype.getSource, arguments);
    };
    __ui_EventObject.prototype.__class__.getSource.unbound_method = true;
    __ui_EventObject.prototype.getSource.instance_method = true;
}
function __ui_FormSubmitEvent() {
}
function ui_FormSubmitEvent(source) {
    var instance = new __ui_FormSubmitEvent();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FormSubmitEvent_initialize() {
    if(__ui_FormSubmitEvent.__was_initialized__) return;
    __ui_FormSubmitEvent.__was_initialized__ = true;
    if(!__ui_EventObject.__was_initialized__)
        __ui_EventObject_initialize();
    pyjs_extend(__ui_FormSubmitEvent, __ui_EventObject);
    __ui_FormSubmitEvent.prototype.__class__.__new__ = ui_FormSubmitEvent;
    __ui_FormSubmitEvent.prototype.__init__ = function(source) {
    __ui_EventObject.prototype.__class__.__init__(this, source);
    this.cancel = false;
    };
    __ui_FormSubmitEvent.prototype.__class__.__init__ = function() {
        return __ui_FormSubmitEvent.prototype.__init__.call.apply(__ui_FormSubmitEvent.prototype.__init__, arguments);
    };
    __ui_FormSubmitEvent.prototype.__class__.__init__.unbound_method = true;
    __ui_FormSubmitEvent.prototype.__init__.instance_method = true;
    __ui_FormSubmitEvent.prototype.isCancelled = function() {
    return this.cancel;
    };
    __ui_FormSubmitEvent.prototype.__class__.isCancelled = function() {
        return __ui_FormSubmitEvent.prototype.isCancelled.call.apply(__ui_FormSubmitEvent.prototype.isCancelled, arguments);
    };
    __ui_FormSubmitEvent.prototype.__class__.isCancelled.unbound_method = true;
    __ui_FormSubmitEvent.prototype.isCancelled.instance_method = true;
    __ui_FormSubmitEvent.prototype.setCancelled = function(cancel) {
    this.cancel = cancel;
    };
    __ui_FormSubmitEvent.prototype.__class__.setCancelled = function() {
        return __ui_FormSubmitEvent.prototype.setCancelled.call.apply(__ui_FormSubmitEvent.prototype.setCancelled, arguments);
    };
    __ui_FormSubmitEvent.prototype.__class__.setCancelled.unbound_method = true;
    __ui_FormSubmitEvent.prototype.setCancelled.instance_method = true;
}
function __ui_FormSubmitCompleteEvent() {
}
function ui_FormSubmitCompleteEvent(source, results) {
    var instance = new __ui_FormSubmitCompleteEvent();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_FormSubmitCompleteEvent_initialize() {
    if(__ui_FormSubmitCompleteEvent.__was_initialized__) return;
    __ui_FormSubmitCompleteEvent.__was_initialized__ = true;
    if(!__ui_EventObject.__was_initialized__)
        __ui_EventObject_initialize();
    pyjs_extend(__ui_FormSubmitCompleteEvent, __ui_EventObject);
    __ui_FormSubmitCompleteEvent.prototype.__class__.__new__ = ui_FormSubmitCompleteEvent;
    __ui_FormSubmitCompleteEvent.prototype.__init__ = function(source, results) {
    __ui_EventObject.prototype.__class__.__init__(this, source);
    this.results = results;
    };
    __ui_FormSubmitCompleteEvent.prototype.__class__.__init__ = function() {
        return __ui_FormSubmitCompleteEvent.prototype.__init__.call.apply(__ui_FormSubmitCompleteEvent.prototype.__init__, arguments);
    };
    __ui_FormSubmitCompleteEvent.prototype.__class__.__init__.unbound_method = true;
    __ui_FormSubmitCompleteEvent.prototype.__init__.instance_method = true;
    __ui_FormSubmitCompleteEvent.prototype.getResults = function() {
    return this.results;
    };
    __ui_FormSubmitCompleteEvent.prototype.__class__.getResults = function() {
        return __ui_FormSubmitCompleteEvent.prototype.getResults.call.apply(__ui_FormSubmitCompleteEvent.prototype.getResults, arguments);
    };
    __ui_FormSubmitCompleteEvent.prototype.__class__.getResults.unbound_method = true;
    __ui_FormSubmitCompleteEvent.prototype.getResults.instance_method = true;
}
    var ui_FormPanel_formId = 0;
function __ui_FormPanel() {
}
function ui_FormPanel(target) {
    if (typeof target == 'undefined') target=null;
    var instance = new __ui_FormPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


ui_FormPanel.parse_kwargs = function ( __kwargs, target ) {
    if (typeof target == 'undefined')
        target=__kwargs.target;
    var __r = [target];
    return __r;
};
function __ui_FormPanel_initialize() {
    if(__ui_FormPanel.__was_initialized__) return;
    __ui_FormPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_FormPanel, __ui_SimplePanel);
    __ui_FormPanel.prototype.__class__.__new__ = ui_FormPanel;
    __ui_FormPanel.prototype.__class__.ENCODING_MULTIPART = 'multipart/form-data';
    __ui_FormPanel.prototype.__class__.ENCODING_URLENCODED = 'application/x-www-form-urlencoded';
    __ui_FormPanel.prototype.__class__.METHOD_GET = 'get';
    __ui_FormPanel.prototype.__class__.METHOD_POST = 'post';
    __ui_FormPanel.prototype.__init__ = function(target) {
    if (typeof target == 'undefined') target=null;
    if (pyjslib_hasattr(target, 'getName')) {
    var target = target.getName();
    }
    __ui_SimplePanel.prototype.__class__.__init__(this, DOM_createForm());
    this.formHandlers = new pyjslib_List([]);
    this.iframe = null;
    ui_FormPanel_formId += 1;
    var formName =  ( 'FormPanel_' + pyjslib_str(ui_FormPanel_formId) ) ;
    DOM_setAttribute(this.getElement(), 'target', formName);
    DOM_setInnerHTML(this.getElement(),  (  ( '<iframe name=\'' + formName )  + '\'>' ) );
    this.iframe = DOM_getFirstChild(this.getElement());
    DOM_setIntStyleAttribute(this.iframe, 'width', 0);
    DOM_setIntStyleAttribute(this.iframe, 'height', 0);
    DOM_setIntStyleAttribute(this.iframe, 'border', 0);
    this.sinkEvents(__ui_Event.prototype.__class__.ONLOAD);
    if ((target != null)) {
    this.setTarget(target);
    }
    };
__ui_FormPanel.prototype.__init__.parse_kwargs = function ( __kwargs, target ) {
    if (typeof target == 'undefined')
        target=__kwargs.target;
    var __r = [target];
    return __r;
};
    __ui_FormPanel.prototype.__class__.__init__ = function() {
        return __ui_FormPanel.prototype.__init__.call.apply(__ui_FormPanel.prototype.__init__, arguments);
    };
    __ui_FormPanel.prototype.__class__.__init__.unbound_method = true;
    __ui_FormPanel.prototype.__init__.instance_method = true;
    __ui_FormPanel.prototype.__class__.__init__.parse_kwargs = __ui_FormPanel.prototype.__init__.parse_kwargs;
    __ui_FormPanel.prototype.addFormHandler = function(handler) {
    this.formHandlers.append(handler);
    };
    __ui_FormPanel.prototype.__class__.addFormHandler = function() {
        return __ui_FormPanel.prototype.addFormHandler.call.apply(__ui_FormPanel.prototype.addFormHandler, arguments);
    };
    __ui_FormPanel.prototype.__class__.addFormHandler.unbound_method = true;
    __ui_FormPanel.prototype.addFormHandler.instance_method = true;
    __ui_FormPanel.prototype.getAction = function() {
    return DOM_getAttribute(this.getElement(), 'action');
    };
    __ui_FormPanel.prototype.__class__.getAction = function() {
        return __ui_FormPanel.prototype.getAction.call.apply(__ui_FormPanel.prototype.getAction, arguments);
    };
    __ui_FormPanel.prototype.__class__.getAction.unbound_method = true;
    __ui_FormPanel.prototype.getAction.instance_method = true;
    __ui_FormPanel.prototype.getEncoding = function() {

        return this.getElement().enctype;
        
    };
    __ui_FormPanel.prototype.__class__.getEncoding = function() {
        return __ui_FormPanel.prototype.getEncoding.call.apply(__ui_FormPanel.prototype.getEncoding, arguments);
    };
    __ui_FormPanel.prototype.__class__.getEncoding.unbound_method = true;
    __ui_FormPanel.prototype.getEncoding.instance_method = true;
    __ui_FormPanel.prototype.getMethod = function() {
    return DOM_getAttribute(this.getElement(), 'method');
    };
    __ui_FormPanel.prototype.__class__.getMethod = function() {
        return __ui_FormPanel.prototype.getMethod.call.apply(__ui_FormPanel.prototype.getMethod, arguments);
    };
    __ui_FormPanel.prototype.__class__.getMethod.unbound_method = true;
    __ui_FormPanel.prototype.getMethod.instance_method = true;
    __ui_FormPanel.prototype.getTarget = function() {
    return DOM_getAttribute(this.getElement(), 'target');
    };
    __ui_FormPanel.prototype.__class__.getTarget = function() {
        return __ui_FormPanel.prototype.getTarget.call.apply(__ui_FormPanel.prototype.getTarget, arguments);
    };
    __ui_FormPanel.prototype.__class__.getTarget.unbound_method = true;
    __ui_FormPanel.prototype.getTarget.instance_method = true;
    __ui_FormPanel.prototype.getTextContents = function(iframe) {

        try {
            if (!iframe.contentWindow.document)
                return null;

            return iframe.contentWindow.document.body.innerHTML;
        } catch (e) {
            return null;
        }
        
    };
    __ui_FormPanel.prototype.__class__.getTextContents = function() {
        return __ui_FormPanel.prototype.getTextContents.call.apply(__ui_FormPanel.prototype.getTextContents, arguments);
    };
    __ui_FormPanel.prototype.__class__.getTextContents.unbound_method = true;
    __ui_FormPanel.prototype.getTextContents.instance_method = true;
    __ui_FormPanel.prototype.hookEvents = function(iframe, form, listener) {

        if (iframe) {
            iframe.onload = function() {
                if (!iframe.__formAction)
                    return;

                listener.onFrameLoad();
            };
        }

        form.onsubmit = function() {
            if (iframe)
                iframe.__formAction = form.action;
            return listener.onFormSubmit();
        };
        
    };
    __ui_FormPanel.prototype.__class__.hookEvents = function() {
        return __ui_FormPanel.prototype.hookEvents.call.apply(__ui_FormPanel.prototype.hookEvents, arguments);
    };
    __ui_FormPanel.prototype.__class__.hookEvents.unbound_method = true;
    __ui_FormPanel.prototype.hookEvents.instance_method = true;
    __ui_FormPanel.prototype.onFormSubmit = function() {
    var event = ui_FormSubmitEvent(this);

        var __handler = this.formHandlers.__iter__();
        try {
            while (true) {
                var handler = __handler.next();
                
        
    handler.onSubmit(event);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return !(event.isCancelled());
    };
    __ui_FormPanel.prototype.__class__.onFormSubmit = function() {
        return __ui_FormPanel.prototype.onFormSubmit.call.apply(__ui_FormPanel.prototype.onFormSubmit, arguments);
    };
    __ui_FormPanel.prototype.__class__.onFormSubmit.unbound_method = true;
    __ui_FormPanel.prototype.onFormSubmit.instance_method = true;
    __ui_FormPanel.prototype.onFrameLoad = function() {
    var event = ui_FormSubmitCompleteEvent(this, this.getTextContents(this.iframe));

        var __handler = this.formHandlers.__iter__();
        try {
            while (true) {
                var handler = __handler.next();
                
        
    handler.onSubmitComplete(event);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __ui_FormPanel.prototype.__class__.onFrameLoad = function() {
        return __ui_FormPanel.prototype.onFrameLoad.call.apply(__ui_FormPanel.prototype.onFrameLoad, arguments);
    };
    __ui_FormPanel.prototype.__class__.onFrameLoad.unbound_method = true;
    __ui_FormPanel.prototype.onFrameLoad.instance_method = true;
    __ui_FormPanel.prototype.removeFormHandler = function(handler) {
    this.formHandlers.remove(handler);
    };
    __ui_FormPanel.prototype.__class__.removeFormHandler = function() {
        return __ui_FormPanel.prototype.removeFormHandler.call.apply(__ui_FormPanel.prototype.removeFormHandler, arguments);
    };
    __ui_FormPanel.prototype.__class__.removeFormHandler.unbound_method = true;
    __ui_FormPanel.prototype.removeFormHandler.instance_method = true;
    __ui_FormPanel.prototype.setAction = function(url) {
    DOM_setAttribute(this.getElement(), 'action', url);
    };
    __ui_FormPanel.prototype.__class__.setAction = function() {
        return __ui_FormPanel.prototype.setAction.call.apply(__ui_FormPanel.prototype.setAction, arguments);
    };
    __ui_FormPanel.prototype.__class__.setAction.unbound_method = true;
    __ui_FormPanel.prototype.setAction.instance_method = true;
    __ui_FormPanel.prototype.setEncoding = function(encodingType) {

        var form = this.getElement();
        form.enctype = encodingType;
        form.encoding = encodingType;
        
    };
    __ui_FormPanel.prototype.__class__.setEncoding = function() {
        return __ui_FormPanel.prototype.setEncoding.call.apply(__ui_FormPanel.prototype.setEncoding, arguments);
    };
    __ui_FormPanel.prototype.__class__.setEncoding.unbound_method = true;
    __ui_FormPanel.prototype.setEncoding.instance_method = true;
    __ui_FormPanel.prototype.setMethod = function(method) {
    DOM_setAttribute(this.getElement(), 'method', method);
    };
    __ui_FormPanel.prototype.__class__.setMethod = function() {
        return __ui_FormPanel.prototype.setMethod.call.apply(__ui_FormPanel.prototype.setMethod, arguments);
    };
    __ui_FormPanel.prototype.__class__.setMethod.unbound_method = true;
    __ui_FormPanel.prototype.setMethod.instance_method = true;
    __ui_FormPanel.prototype.submit = function() {
    var event = ui_FormSubmitEvent(this);

        var __handler = this.formHandlers.__iter__();
        try {
            while (true) {
                var handler = __handler.next();
                
        
    handler.onSubmit(event);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    if (event.isCancelled()) {
    return;
    }
    this.submitImpl(this.getElement(), this.iframe);
    };
    __ui_FormPanel.prototype.__class__.submit = function() {
        return __ui_FormPanel.prototype.submit.call.apply(__ui_FormPanel.prototype.submit, arguments);
    };
    __ui_FormPanel.prototype.__class__.submit.unbound_method = true;
    __ui_FormPanel.prototype.submit.instance_method = true;
    __ui_FormPanel.prototype.submitImpl = function(form, iframe) {

        if (iframe)
            iframe.__formAction = form.action;
        form.submit();
        
    };
    __ui_FormPanel.prototype.__class__.submitImpl = function() {
        return __ui_FormPanel.prototype.submitImpl.call.apply(__ui_FormPanel.prototype.submitImpl, arguments);
    };
    __ui_FormPanel.prototype.__class__.submitImpl.unbound_method = true;
    __ui_FormPanel.prototype.submitImpl.instance_method = true;
    __ui_FormPanel.prototype.onAttach = function() {
    __ui_SimplePanel.prototype.__class__.onAttach(this);
    this.hookEvents(this.iframe, this.getElement(), this);
    };
    __ui_FormPanel.prototype.__class__.onAttach = function() {
        return __ui_FormPanel.prototype.onAttach.call.apply(__ui_FormPanel.prototype.onAttach, arguments);
    };
    __ui_FormPanel.prototype.__class__.onAttach.unbound_method = true;
    __ui_FormPanel.prototype.onAttach.instance_method = true;
    __ui_FormPanel.prototype.onDetach = function() {
    __ui_SimplePanel.prototype.__class__.onDetach(this);
    this.unhookEvents(this.iframe, this.getElement());
    };
    __ui_FormPanel.prototype.__class__.onDetach = function() {
        return __ui_FormPanel.prototype.onDetach.call.apply(__ui_FormPanel.prototype.onDetach, arguments);
    };
    __ui_FormPanel.prototype.__class__.onDetach.unbound_method = true;
    __ui_FormPanel.prototype.onDetach.instance_method = true;
    __ui_FormPanel.prototype.setTarget = function(target) {
    DOM_setAttribute(this.getElement(), 'target', target);
    };
    __ui_FormPanel.prototype.__class__.setTarget = function() {
        return __ui_FormPanel.prototype.setTarget.call.apply(__ui_FormPanel.prototype.setTarget, arguments);
    };
    __ui_FormPanel.prototype.__class__.setTarget.unbound_method = true;
    __ui_FormPanel.prototype.setTarget.instance_method = true;
    __ui_FormPanel.prototype.unhookEvents = function(iframe, form) {

        if (iframe)
            iframe.onload = null;
        form.onsubmit = null;
        
    };
    __ui_FormPanel.prototype.__class__.unhookEvents = function() {
        return __ui_FormPanel.prototype.unhookEvents.call.apply(__ui_FormPanel.prototype.unhookEvents, arguments);
    };
    __ui_FormPanel.prototype.__class__.unhookEvents.unbound_method = true;
    __ui_FormPanel.prototype.unhookEvents.instance_method = true;
}
function __ui_ClickableHeader() {
}
function ui_ClickableHeader(disclosurePanel) {
    var instance = new __ui_ClickableHeader();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_ClickableHeader_initialize() {
    if(__ui_ClickableHeader.__was_initialized__) return;
    __ui_ClickableHeader.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__ui_ClickableHeader, __ui_SimplePanel);
    __ui_ClickableHeader.prototype.__class__.__new__ = ui_ClickableHeader;
    __ui_ClickableHeader.prototype.__init__ = function(disclosurePanel) {
    __ui_SimplePanel.prototype.__class__.__init__(this, DOM_createAnchor());
    this.disclosurePanel = disclosurePanel;
    var element = this.getElement();
    DOM_setStyleAttribute(element, 'display', 'block');
    this.sinkEvents(__ui_Event.prototype.__class__.ONCLICK);
    this.setStyleName('gwt-disclosurePanel-header');
    };
    __ui_ClickableHeader.prototype.__class__.__init__ = function() {
        return __ui_ClickableHeader.prototype.__init__.call.apply(__ui_ClickableHeader.prototype.__init__, arguments);
    };
    __ui_ClickableHeader.prototype.__class__.__init__.unbound_method = true;
    __ui_ClickableHeader.prototype.__init__.instance_method = true;
    __ui_ClickableHeader.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {
    DOM_eventPreventDefault(event);
    var currentState = this.disclosurePanel.getOpen();
    var invertedState = !(currentState);
    this.disclosurePanel.setOpen(invertedState);
    }
    };
    __ui_ClickableHeader.prototype.__class__.onBrowserEvent = function() {
        return __ui_ClickableHeader.prototype.onBrowserEvent.call.apply(__ui_ClickableHeader.prototype.onBrowserEvent, arguments);
    };
    __ui_ClickableHeader.prototype.__class__.onBrowserEvent.unbound_method = true;
    __ui_ClickableHeader.prototype.onBrowserEvent.instance_method = true;
}
function __ui_DefaultHeader() {
}
function ui_DefaultHeader(text, disclosurePanel) {
    var instance = new __ui_DefaultHeader();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DefaultHeader_initialize() {
    if(__ui_DefaultHeader.__was_initialized__) return;
    __ui_DefaultHeader.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__ui_DefaultHeader, __ui_Widget);
    __ui_DefaultHeader.prototype.__class__.__new__ = ui_DefaultHeader;
    __ui_DefaultHeader.prototype.__init__ = function(text, disclosurePanel) {
    this.disclosurePanel = disclosurePanel;
    this.imageBase = pygwt_getModuleBaseURL();
    this.root = DOM_createTable();
    this.tbody = DOM_createTBody();
    this.tr = DOM_createTR();
    this.imageTD = DOM_createTD();
    this.labelTD = DOM_createTD();
    this.imgElem = DOM_createImg();
    this.updateState();
    this.setElement(this.root);
    DOM_appendChild(this.root, this.tbody);
    DOM_appendChild(this.tbody, this.tr);
    DOM_appendChild(this.tr, this.imageTD);
    DOM_appendChild(this.tr, this.labelTD);
    DOM_appendChild(this.imageTD, this.imgElem);
    this.setText(text);
    };
    __ui_DefaultHeader.prototype.__class__.__init__ = function() {
        return __ui_DefaultHeader.prototype.__init__.call.apply(__ui_DefaultHeader.prototype.__init__, arguments);
    };
    __ui_DefaultHeader.prototype.__class__.__init__.unbound_method = true;
    __ui_DefaultHeader.prototype.__init__.instance_method = true;
    __ui_DefaultHeader.prototype.getText = function() {
    return DOM_getInnerText(this.labelTD);
    };
    __ui_DefaultHeader.prototype.__class__.getText = function() {
        return __ui_DefaultHeader.prototype.getText.call.apply(__ui_DefaultHeader.prototype.getText, arguments);
    };
    __ui_DefaultHeader.prototype.__class__.getText.unbound_method = true;
    __ui_DefaultHeader.prototype.getText.instance_method = true;
    __ui_DefaultHeader.prototype.setText = function(text) {
    DOM_setInnerText(this.labelTD, text);
    };
    __ui_DefaultHeader.prototype.__class__.setText = function() {
        return __ui_DefaultHeader.prototype.setText.call.apply(__ui_DefaultHeader.prototype.setText, arguments);
    };
    __ui_DefaultHeader.prototype.__class__.setText.unbound_method = true;
    __ui_DefaultHeader.prototype.setText.instance_method = true;
    __ui_DefaultHeader.prototype.updateState = function() {
    if (this.disclosurePanel.getOpen()) {
    DOM_setAttribute(this.imgElem, 'src',  ( this.imageBase + 'disclosurePanelOpen.png' ) );
    }
    else {
    DOM_setAttribute(this.imgElem, 'src',  ( this.imageBase + 'disclosurePanelClosed.png' ) );
    }
    };
    __ui_DefaultHeader.prototype.__class__.updateState = function() {
        return __ui_DefaultHeader.prototype.updateState.call.apply(__ui_DefaultHeader.prototype.updateState, arguments);
    };
    __ui_DefaultHeader.prototype.__class__.updateState.unbound_method = true;
    __ui_DefaultHeader.prototype.updateState.instance_method = true;
}
function __ui_DisclosurePanel() {
}
function ui_DisclosurePanel(headerText, isOpen) {
    var instance = new __ui_DisclosurePanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __ui_DisclosurePanel_initialize() {
    if(__ui_DisclosurePanel.__was_initialized__) return;
    __ui_DisclosurePanel.__was_initialized__ = true;
    if(!__ui_Composite.__was_initialized__)
        __ui_Composite_initialize();
    pyjs_extend(__ui_DisclosurePanel, __ui_Composite);
    __ui_DisclosurePanel.prototype.__class__.__new__ = ui_DisclosurePanel;
    __ui_DisclosurePanel.prototype.__init__ = function(headerText, isOpen) {
    this.mainPanel = ui_VerticalPanel();
    this.header = ui_ClickableHeader(this);
    this.contentWrapper = ui_SimplePanel();
    this.mainPanel.add(this.header);
    this.mainPanel.add(this.contentWrapper);
    this.isOpen = isOpen;
    this.headerObj = ui_DefaultHeader(headerText, this);
    this.setHeader(this.headerObj);
    this.setContentDisplay();
    this.initWidget(this.mainPanel);
    };
    __ui_DisclosurePanel.prototype.__class__.__init__ = function() {
        return __ui_DisclosurePanel.prototype.__init__.call.apply(__ui_DisclosurePanel.prototype.__init__, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.__init__.unbound_method = true;
    __ui_DisclosurePanel.prototype.__init__.instance_method = true;
    __ui_DisclosurePanel.prototype.add = function(widget) {
    if ((this.getContent() == null)) {
    this.setContent(widget);
    }
    };
    __ui_DisclosurePanel.prototype.__class__.add = function() {
        return __ui_DisclosurePanel.prototype.add.call.apply(__ui_DisclosurePanel.prototype.add, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.add.unbound_method = true;
    __ui_DisclosurePanel.prototype.add.instance_method = true;
    __ui_DisclosurePanel.prototype.clear = function() {
    this.setContent(null);
    };
    __ui_DisclosurePanel.prototype.__class__.clear = function() {
        return __ui_DisclosurePanel.prototype.clear.call.apply(__ui_DisclosurePanel.prototype.clear, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.clear.unbound_method = true;
    __ui_DisclosurePanel.prototype.clear.instance_method = true;
    __ui_DisclosurePanel.prototype.getContent = function() {
    return this.content;
    };
    __ui_DisclosurePanel.prototype.__class__.getContent = function() {
        return __ui_DisclosurePanel.prototype.getContent.call.apply(__ui_DisclosurePanel.prototype.getContent, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.getContent.unbound_method = true;
    __ui_DisclosurePanel.prototype.getContent.instance_method = true;
    __ui_DisclosurePanel.prototype.getHeader = function() {
    return this.header.getWidget();
    };
    __ui_DisclosurePanel.prototype.__class__.getHeader = function() {
        return __ui_DisclosurePanel.prototype.getHeader.call.apply(__ui_DisclosurePanel.prototype.getHeader, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.getHeader.unbound_method = true;
    __ui_DisclosurePanel.prototype.getHeader.instance_method = true;
    __ui_DisclosurePanel.prototype.getOpen = function() {
    return this.isOpen;
    };
    __ui_DisclosurePanel.prototype.__class__.getOpen = function() {
        return __ui_DisclosurePanel.prototype.getOpen.call.apply(__ui_DisclosurePanel.prototype.getOpen, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.getOpen.unbound_method = true;
    __ui_DisclosurePanel.prototype.getOpen.instance_method = true;
    __ui_DisclosurePanel.prototype.remove = function(widget) {
    if ((widget == this.getContent())) {
    this.setContent(null);
    return true;
    }
    return false;
    };
    __ui_DisclosurePanel.prototype.__class__.remove = function() {
        return __ui_DisclosurePanel.prototype.remove.call.apply(__ui_DisclosurePanel.prototype.remove, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.remove.unbound_method = true;
    __ui_DisclosurePanel.prototype.remove.instance_method = true;
    __ui_DisclosurePanel.prototype.setContent = function(widget) {
    if ((this.content != null)) {
    this.contentWrapper.setWidget(null);
    }
    this.content = widget;
    if ((this.content != null)) {
    this.contentWrapper.setWidget(this.content);
    }
    };
    __ui_DisclosurePanel.prototype.__class__.setContent = function() {
        return __ui_DisclosurePanel.prototype.setContent.call.apply(__ui_DisclosurePanel.prototype.setContent, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.setContent.unbound_method = true;
    __ui_DisclosurePanel.prototype.setContent.instance_method = true;
    __ui_DisclosurePanel.prototype.setHeader = function(widget) {
    this.header.setWidget(widget);
    };
    __ui_DisclosurePanel.prototype.__class__.setHeader = function() {
        return __ui_DisclosurePanel.prototype.setHeader.call.apply(__ui_DisclosurePanel.prototype.setHeader, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.setHeader.unbound_method = true;
    __ui_DisclosurePanel.prototype.setHeader.instance_method = true;
    __ui_DisclosurePanel.prototype.setOpen = function(isOpen) {
    if ((this.isOpen != isOpen)) {
    this.isOpen = isOpen;
    }
    this.setContentDisplay();
    };
    __ui_DisclosurePanel.prototype.__class__.setOpen = function() {
        return __ui_DisclosurePanel.prototype.setOpen.call.apply(__ui_DisclosurePanel.prototype.setOpen, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.setOpen.unbound_method = true;
    __ui_DisclosurePanel.prototype.setOpen.instance_method = true;
    __ui_DisclosurePanel.prototype.setContentDisplay = function() {
    this.contentWrapper.setVisible(this.isOpen);
    this.headerObj.updateState();
    };
    __ui_DisclosurePanel.prototype.__class__.setContentDisplay = function() {
        return __ui_DisclosurePanel.prototype.setContentDisplay.call.apply(__ui_DisclosurePanel.prototype.setContentDisplay, arguments);
    };
    __ui_DisclosurePanel.prototype.__class__.setContentDisplay.unbound_method = true;
    __ui_DisclosurePanel.prototype.setContentDisplay.instance_method = true;
}
__ui_RootTreeItem_initialize();
__ui_CheckBox_initialize();
__ui_NamedFrame_initialize();
__ui_FileUpload_initialize();
__ui_Label_initialize();
__ui_KeyboardListener_initialize();
__ui_DockPanel_initialize();
__ui_EventObject_initialize();
__ui_FormSubmitEvent_initialize();
__ui_TextBoxBase_initialize();
__ui_Hidden_initialize();
__ui_TreeContentPanel_initialize();
__ui_DialogBox_initialize();
__ui_MenuBar_initialize();
__ui_Widget_initialize();
__ui_FlowPanel_initialize();
__ui_FlexCellFormatter_initialize();
__ui_HorizontalPanel_initialize();
__ui_TextArea_initialize();
__ui_Composite_initialize();
__ui_RowFormatter_initialize();
__ui_UIObject_initialize();
__ui_FormPanel_initialize();
__ui_DefaultHeader_initialize();
__ui_ClickableHeader_initialize();
__ui_PasswordTextBox_initialize();
__ui_HTML_initialize();
__ui_Grid_initialize();
__ui_FocusWidget_initialize();
__ui_FocusPanel_initialize();
__ui_HasHorizontalAlignment_initialize();
__ui_DeckPanel_initialize();
__ui_Frame_initialize();
__ui_Panel_initialize();
__ui_HasAlignment_initialize();
__ui_SimplePanel_initialize();
__ui_VerticalPanel_initialize();
__ui_Hyperlink_initialize();
__ui_StackPanel_initialize();
__ui_Button_initialize();
__ui_Tree_initialize();
__ui_ScrollPanel_initialize();
__ui_ComplexPanel_initialize();
__ui_TabPanel_initialize();
__ui_TabBar_initialize();
__ui_CellPanel_initialize();
__ui_DisclosurePanel_initialize();
__ui_PopupPanel_initialize();
__ui_DockPanelTmpRow_initialize();
__ui_ListBox_initialize();
__ui_FocusListener_initialize();
__ui_TextBox_initialize();
__ui_FlexTable_initialize();
__ui_CellFormatter_initialize();
__ui_LayoutData_initialize();
__ui_HasVerticalAlignment_initialize();
__ui_Image_initialize();
__ui_MouseListener_initialize();
__ui_RadioButton_initialize();
__ui_HTMLPanel_initialize();
__ui_Event_initialize();
__ui_ButtonBase_initialize();
__ui_Focus_initialize();
__ui_TreeItem_initialize();
__ui_RootPanelCls_initialize();
__ui_MenuBarPopupPanel_initialize();
__ui_MenuItem_initialize();
__ui_FormSubmitCompleteEvent_initialize();
__ui_HTMLTable_initialize();
__ui_AbsolutePanel_initialize();
__ui_ClickDelegatePanel_initialize();
    var Tooltip_tooltip_hide_timer = null;
function __Tooltip_Tooltip() {
}
function Tooltip_Tooltip(sender, offsetX, offsetY, text, show_delay, hide_delay, styleName) {
    var instance = new __Tooltip_Tooltip();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __Tooltip_Tooltip_initialize() {
    if(__Tooltip_Tooltip.__was_initialized__) return;
    __Tooltip_Tooltip.__was_initialized__ = true;
    if(!__ui_PopupPanel.__was_initialized__)
        __ui_PopupPanel_initialize();
    pyjs_extend(__Tooltip_Tooltip, __ui_PopupPanel);
    __Tooltip_Tooltip.prototype.__class__.__new__ = Tooltip_Tooltip;
    __Tooltip_Tooltip.prototype.__init__ = function(sender, offsetX, offsetY, text, show_delay, hide_delay, styleName) {
    __ui_PopupPanel.prototype.__class__.__init__(this, true);
    this.show_delay = show_delay;
    this.hide_delay = hide_delay;
    var contents = ui_HTML(text);
    this.add(contents);
    var left =  ( sender.getAbsoluteLeft() + offsetX ) ;
    var top =  ( sender.getAbsoluteTop() + offsetY ) ;
    this.setPopupPosition(left, top);
    this.setStyleName(styleName);
    if (Tooltip_tooltip_hide_timer) {
    this.tooltip_show_timer = Timer_Timer(1, this);
    }
    else {
    this.tooltip_show_timer = Timer_Timer(this.show_delay, this);
    }
    };
    __Tooltip_Tooltip.prototype.__class__.__init__ = function() {
        return __Tooltip_Tooltip.prototype.__init__.call.apply(__Tooltip_Tooltip.prototype.__init__, arguments);
    };
    __Tooltip_Tooltip.prototype.__class__.__init__.unbound_method = true;
    __Tooltip_Tooltip.prototype.__init__.instance_method = true;
    __Tooltip_Tooltip.prototype.show = function() {
    Tooltip_tooltip_hide_timer = Timer_Timer(this.hide_delay, this);
    __ui_PopupPanel.prototype.__class__.show(this);
    };
    __Tooltip_Tooltip.prototype.__class__.show = function() {
        return __Tooltip_Tooltip.prototype.show.call.apply(__Tooltip_Tooltip.prototype.show, arguments);
    };
    __Tooltip_Tooltip.prototype.__class__.show.unbound_method = true;
    __Tooltip_Tooltip.prototype.show.instance_method = true;
    __Tooltip_Tooltip.prototype.hide = function() {
    this.tooltip_show_timer.cancel();
    __ui_PopupPanel.prototype.__class__.hide(this);
    };
    __Tooltip_Tooltip.prototype.__class__.hide = function() {
        return __Tooltip_Tooltip.prototype.hide.call.apply(__Tooltip_Tooltip.prototype.hide, arguments);
    };
    __Tooltip_Tooltip.prototype.__class__.hide.unbound_method = true;
    __Tooltip_Tooltip.prototype.hide.instance_method = true;
    __Tooltip_Tooltip.prototype.onTimer = function(id) {
    if ((Tooltip_tooltip_hide_timer) && ((id == Tooltip_tooltip_hide_timer.getID()))) {
    Tooltip_tooltip_hide_timer = null;
    }
    if ((id == this.tooltip_show_timer.getID())) {
    this.show();
    }
    else {
    this.hide();
    }
    };
    __Tooltip_Tooltip.prototype.__class__.onTimer = function() {
        return __Tooltip_Tooltip.prototype.onTimer.call.apply(__Tooltip_Tooltip.prototype.onTimer, arguments);
    };
    __Tooltip_Tooltip.prototype.__class__.onTimer.unbound_method = true;
    __Tooltip_Tooltip.prototype.onTimer.instance_method = true;
}
function __Tooltip_TooltipListener() {
}
function Tooltip_TooltipListener(text, show_delay, hide_delay, styleName) {
    if (typeof show_delay == 'undefined') show_delay=1000;
    if (typeof hide_delay == 'undefined') hide_delay=5000;
    if (typeof styleName == 'undefined') styleName='';
    var instance = new __Tooltip_TooltipListener();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


Tooltip_TooltipListener.parse_kwargs = function ( __kwargs, text, show_delay, hide_delay, styleName ) {
    if (typeof show_delay == 'undefined')
        show_delay=__kwargs.show_delay;
    if (typeof hide_delay == 'undefined')
        hide_delay=__kwargs.hide_delay;
    if (typeof styleName == 'undefined')
        styleName=__kwargs.styleName;
    var __r = [text, show_delay, hide_delay, styleName];
    return __r;
};
function __Tooltip_TooltipListener_initialize() {
    if(__Tooltip_TooltipListener.__was_initialized__) return;
    __Tooltip_TooltipListener.__was_initialized__ = true;
    pyjs_extend(__Tooltip_TooltipListener, __pyjslib_Object);
    __Tooltip_TooltipListener.prototype.__class__.__new__ = Tooltip_TooltipListener;
    __Tooltip_TooltipListener.prototype.__class__.DEFAULT_TOOLTIP_STYLE = 'TooltipPopup';
    __Tooltip_TooltipListener.prototype.__class__.DEFAULT_OFFSET_X = 10;
    __Tooltip_TooltipListener.prototype.__class__.DEFAULT_OFFSET_Y = 35;
    __Tooltip_TooltipListener.prototype.__init__ = function(text, show_delay, hide_delay, styleName) {
    if (typeof show_delay == 'undefined') show_delay=1000;
    if (typeof hide_delay == 'undefined') hide_delay=5000;
    if (typeof styleName == 'undefined') styleName='';
    if (!(styleName)) {
    var styleName = __Tooltip_TooltipListener.prototype.__class__.DEFAULT_TOOLTIP_STYLE;
    }
    this.tooltip = null;
    this.text = text;
    this.styleName = styleName;
    this.show_delay = show_delay;
    this.hide_delay = hide_delay;
    this.offsetX = __Tooltip_TooltipListener.prototype.__class__.DEFAULT_OFFSET_X;
    this.offsetY = __Tooltip_TooltipListener.prototype.__class__.DEFAULT_OFFSET_Y;
    };
__Tooltip_TooltipListener.prototype.__init__.parse_kwargs = function ( __kwargs, text, show_delay, hide_delay, styleName ) {
    if (typeof show_delay == 'undefined')
        show_delay=__kwargs.show_delay;
    if (typeof hide_delay == 'undefined')
        hide_delay=__kwargs.hide_delay;
    if (typeof styleName == 'undefined')
        styleName=__kwargs.styleName;
    var __r = [text, show_delay, hide_delay, styleName];
    return __r;
};
    __Tooltip_TooltipListener.prototype.__class__.__init__ = function() {
        return __Tooltip_TooltipListener.prototype.__init__.call.apply(__Tooltip_TooltipListener.prototype.__init__, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.__init__.unbound_method = true;
    __Tooltip_TooltipListener.prototype.__init__.instance_method = true;
    __Tooltip_TooltipListener.prototype.__class__.__init__.parse_kwargs = __Tooltip_TooltipListener.prototype.__init__.parse_kwargs;
    __Tooltip_TooltipListener.prototype.onMouseEnter = function(sender) {
    if ((this.tooltip != null)) {
    this.tooltip.hide();
    }
    this.tooltip = Tooltip_Tooltip(sender, this.offsetX, this.offsetY, this.text, this.show_delay, this.hide_delay, this.styleName);
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseEnter = function() {
        return __Tooltip_TooltipListener.prototype.onMouseEnter.call.apply(__Tooltip_TooltipListener.prototype.onMouseEnter, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseEnter.unbound_method = true;
    __Tooltip_TooltipListener.prototype.onMouseEnter.instance_method = true;
    __Tooltip_TooltipListener.prototype.onMouseLeave = function(sender) {
    if ((this.tooltip != null)) {
    this.tooltip.hide();
    }
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseLeave = function() {
        return __Tooltip_TooltipListener.prototype.onMouseLeave.call.apply(__Tooltip_TooltipListener.prototype.onMouseLeave, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseLeave.unbound_method = true;
    __Tooltip_TooltipListener.prototype.onMouseLeave.instance_method = true;
    __Tooltip_TooltipListener.prototype.onMouseMove = function(sender, x, y) {
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseMove = function() {
        return __Tooltip_TooltipListener.prototype.onMouseMove.call.apply(__Tooltip_TooltipListener.prototype.onMouseMove, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseMove.unbound_method = true;
    __Tooltip_TooltipListener.prototype.onMouseMove.instance_method = true;
    __Tooltip_TooltipListener.prototype.onMouseDown = function(sender, x, y) {
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseDown = function() {
        return __Tooltip_TooltipListener.prototype.onMouseDown.call.apply(__Tooltip_TooltipListener.prototype.onMouseDown, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseDown.unbound_method = true;
    __Tooltip_TooltipListener.prototype.onMouseDown.instance_method = true;
    __Tooltip_TooltipListener.prototype.onMouseUp = function(sender, x, y) {
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseUp = function() {
        return __Tooltip_TooltipListener.prototype.onMouseUp.call.apply(__Tooltip_TooltipListener.prototype.onMouseUp, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.onMouseUp.unbound_method = true;
    __Tooltip_TooltipListener.prototype.onMouseUp.instance_method = true;
    __Tooltip_TooltipListener.prototype.getStyleName = function() {
    return this.styleName;
    };
    __Tooltip_TooltipListener.prototype.__class__.getStyleName = function() {
        return __Tooltip_TooltipListener.prototype.getStyleName.call.apply(__Tooltip_TooltipListener.prototype.getStyleName, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.getStyleName.unbound_method = true;
    __Tooltip_TooltipListener.prototype.getStyleName.instance_method = true;
    __Tooltip_TooltipListener.prototype.setStyleName = function(styleName) {
    this.styleName = styleName;
    };
    __Tooltip_TooltipListener.prototype.__class__.setStyleName = function() {
        return __Tooltip_TooltipListener.prototype.setStyleName.call.apply(__Tooltip_TooltipListener.prototype.setStyleName, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.setStyleName.unbound_method = true;
    __Tooltip_TooltipListener.prototype.setStyleName.instance_method = true;
    __Tooltip_TooltipListener.prototype.getOffsetX = function() {
    return this.offsetX;
    };
    __Tooltip_TooltipListener.prototype.__class__.getOffsetX = function() {
        return __Tooltip_TooltipListener.prototype.getOffsetX.call.apply(__Tooltip_TooltipListener.prototype.getOffsetX, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.getOffsetX.unbound_method = true;
    __Tooltip_TooltipListener.prototype.getOffsetX.instance_method = true;
    __Tooltip_TooltipListener.prototype.setOffsetX = function(offsetX) {
    this.offsetX = offsetX;
    };
    __Tooltip_TooltipListener.prototype.__class__.setOffsetX = function() {
        return __Tooltip_TooltipListener.prototype.setOffsetX.call.apply(__Tooltip_TooltipListener.prototype.setOffsetX, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.setOffsetX.unbound_method = true;
    __Tooltip_TooltipListener.prototype.setOffsetX.instance_method = true;
    __Tooltip_TooltipListener.prototype.getOffsetY = function() {
    return this.offsetY;
    };
    __Tooltip_TooltipListener.prototype.__class__.getOffsetY = function() {
        return __Tooltip_TooltipListener.prototype.getOffsetY.call.apply(__Tooltip_TooltipListener.prototype.getOffsetY, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.getOffsetY.unbound_method = true;
    __Tooltip_TooltipListener.prototype.getOffsetY.instance_method = true;
    __Tooltip_TooltipListener.prototype.setOffsetY = function(offsetY) {
    this.offsetY = offsetY;
    };
    __Tooltip_TooltipListener.prototype.__class__.setOffsetY = function() {
        return __Tooltip_TooltipListener.prototype.setOffsetY.call.apply(__Tooltip_TooltipListener.prototype.setOffsetY, arguments);
    };
    __Tooltip_TooltipListener.prototype.__class__.setOffsetY.unbound_method = true;
    __Tooltip_TooltipListener.prototype.setOffsetY.instance_method = true;
}
__Tooltip_TooltipListener_initialize();
__Tooltip_Tooltip_initialize();
function __Canvas_Canvas() {
}
function Canvas_Canvas(width, height) {
    var instance = new __Canvas_Canvas();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __Canvas_Canvas_initialize() {
    if(__Canvas_Canvas.__was_initialized__) return;
    __Canvas_Canvas.__was_initialized__ = true;
    if(!__ui_Widget.__was_initialized__)
        __ui_Widget_initialize();
    pyjs_extend(__Canvas_Canvas, __ui_Widget);
    __Canvas_Canvas.prototype.__class__.__new__ = Canvas_Canvas;
    __Canvas_Canvas.prototype.__init__ = function(width, height) {
    this.context = null;
    this.setElement(DOM_createDiv());
    var canvas = DOM_createElement('canvas');
    this.setWidth(width);
    this.setHeight(height);
    canvas.width = width;
    canvas.height = height;
    DOM_appendChild(this.getElement(), canvas);
    this.setStyleName('gwt-Canvas');
    this.init();
    this.context.fillStyle = 'black';
    this.context.strokeStyle = 'black';
    this.focusable = null;
    this.focusable = __ui_Focus.prototype.__class__.createFocusable();
    this.focusListeners = new pyjslib_List([]);
    this.clickListeners = new pyjslib_List([]);
    this.mouseListeners = new pyjslib_List([]);
    this.keyboardListeners = new pyjslib_List([]);
    DOM_appendChild(this.getElement(canvas), this.focusable);
    DOM_sinkEvents(canvas, (__ui_Event.prototype.__class__.ONCLICK | __ui_Event.prototype.__class__.MOUSEEVENTS | DOM_getEventsSunk(canvas)));
    DOM_sinkEvents(this.focusable, (__ui_Event.prototype.__class__.FOCUSEVENTS | __ui_Event.prototype.__class__.KEYEVENTS));
    };
    __Canvas_Canvas.prototype.__class__.__init__ = function() {
        return __Canvas_Canvas.prototype.__init__.call.apply(__Canvas_Canvas.prototype.__init__, arguments);
    };
    __Canvas_Canvas.prototype.__class__.__init__.unbound_method = true;
    __Canvas_Canvas.prototype.__init__.instance_method = true;
    __Canvas_Canvas.prototype.addClickListener = function(listener) {
    this.clickListeners.append(listener);
    };
    __Canvas_Canvas.prototype.__class__.addClickListener = function() {
        return __Canvas_Canvas.prototype.addClickListener.call.apply(__Canvas_Canvas.prototype.addClickListener, arguments);
    };
    __Canvas_Canvas.prototype.__class__.addClickListener.unbound_method = true;
    __Canvas_Canvas.prototype.addClickListener.instance_method = true;
    __Canvas_Canvas.prototype.addMouseListener = function(listener) {
    this.mouseListeners.append(listener);
    };
    __Canvas_Canvas.prototype.__class__.addMouseListener = function() {
        return __Canvas_Canvas.prototype.addMouseListener.call.apply(__Canvas_Canvas.prototype.addMouseListener, arguments);
    };
    __Canvas_Canvas.prototype.__class__.addMouseListener.unbound_method = true;
    __Canvas_Canvas.prototype.addMouseListener.instance_method = true;
    __Canvas_Canvas.prototype.addFocusListener = function(listener) {
    this.focusListeners.append(listener);
    };
    __Canvas_Canvas.prototype.__class__.addFocusListener = function() {
        return __Canvas_Canvas.prototype.addFocusListener.call.apply(__Canvas_Canvas.prototype.addFocusListener, arguments);
    };
    __Canvas_Canvas.prototype.__class__.addFocusListener.unbound_method = true;
    __Canvas_Canvas.prototype.addFocusListener.instance_method = true;
    __Canvas_Canvas.prototype.addKeyboardListener = function(listener) {
    this.keyboardListeners.append(listener);
    };
    __Canvas_Canvas.prototype.__class__.addKeyboardListener = function() {
        return __Canvas_Canvas.prototype.addKeyboardListener.call.apply(__Canvas_Canvas.prototype.addKeyboardListener, arguments);
    };
    __Canvas_Canvas.prototype.__class__.addKeyboardListener.unbound_method = true;
    __Canvas_Canvas.prototype.addKeyboardListener.instance_method = true;
    __Canvas_Canvas.prototype.onBrowserEvent = function(event) {
    var type = DOM_eventGetType(event);
    if ((type == 'click')) {

        var __listener = this.clickListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    if (listener.onClick) {
    listener.onClick(this, event);
    }
    else {
    listener(this, event);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    else if (((type == 'blur')) || ((type == 'focus'))) {
    __ui_FocusListener.prototype.__class__.fireFocusEvent(this, this.focusListeners, this, event);
    }
    else if (((type == 'keydown')) || ((type == 'keypress')) || ((type == 'keyup'))) {
    __ui_KeyboardListener.prototype.__class__.fireKeyboardEvent(this, this.keyboardListeners, this, event);
    }
    else if (((type == 'mousedown')) || ((type == 'mouseup')) || ((type == 'mousemove')) || ((type == 'mouseover')) || ((type == 'mouseout'))) {
    __ui_MouseListener.prototype.__class__.fireMouseEvent(this, this.mouseListeners, this, event);
    }
    };
    __Canvas_Canvas.prototype.__class__.onBrowserEvent = function() {
        return __Canvas_Canvas.prototype.onBrowserEvent.call.apply(__Canvas_Canvas.prototype.onBrowserEvent, arguments);
    };
    __Canvas_Canvas.prototype.__class__.onBrowserEvent.unbound_method = true;
    __Canvas_Canvas.prototype.onBrowserEvent.instance_method = true;
    __Canvas_Canvas.prototype.removeClickListener = function(listener) {
    this.clickListeners.remove(listener);
    };
    __Canvas_Canvas.prototype.__class__.removeClickListener = function() {
        return __Canvas_Canvas.prototype.removeClickListener.call.apply(__Canvas_Canvas.prototype.removeClickListener, arguments);
    };
    __Canvas_Canvas.prototype.__class__.removeClickListener.unbound_method = true;
    __Canvas_Canvas.prototype.removeClickListener.instance_method = true;
    __Canvas_Canvas.prototype.removeMouseListener = function(listener) {
    this.mouseListeners.remove(listener);
    };
    __Canvas_Canvas.prototype.__class__.removeMouseListener = function() {
        return __Canvas_Canvas.prototype.removeMouseListener.call.apply(__Canvas_Canvas.prototype.removeMouseListener, arguments);
    };
    __Canvas_Canvas.prototype.__class__.removeMouseListener.unbound_method = true;
    __Canvas_Canvas.prototype.removeMouseListener.instance_method = true;
    __Canvas_Canvas.prototype.removeFocusListener = function(listener) {
    this.focusListeners.remove(listener);
    };
    __Canvas_Canvas.prototype.__class__.removeFocusListener = function() {
        return __Canvas_Canvas.prototype.removeFocusListener.call.apply(__Canvas_Canvas.prototype.removeFocusListener, arguments);
    };
    __Canvas_Canvas.prototype.__class__.removeFocusListener.unbound_method = true;
    __Canvas_Canvas.prototype.removeFocusListener.instance_method = true;
    __Canvas_Canvas.prototype.removeKeyboardListener = function(listener) {
    this.keyboardListeners.remove(listener);
    };
    __Canvas_Canvas.prototype.__class__.removeKeyboardListener = function() {
        return __Canvas_Canvas.prototype.removeKeyboardListener.call.apply(__Canvas_Canvas.prototype.removeKeyboardListener, arguments);
    };
    __Canvas_Canvas.prototype.__class__.removeKeyboardListener.unbound_method = true;
    __Canvas_Canvas.prototype.removeKeyboardListener.instance_method = true;
    __Canvas_Canvas.prototype.setFocus = function(focused) {
    if (focused) {
    __ui_Focus.prototype.__class__.focus(this, this.focusable);
    }
    else {
    __ui_Focus.prototype.__class__.blur(this, this.focusable);
    }
    };
    __Canvas_Canvas.prototype.__class__.setFocus = function() {
        return __Canvas_Canvas.prototype.setFocus.call.apply(__Canvas_Canvas.prototype.setFocus, arguments);
    };
    __Canvas_Canvas.prototype.__class__.setFocus.unbound_method = true;
    __Canvas_Canvas.prototype.setFocus.instance_method = true;
    __Canvas_Canvas.prototype.getContext = function() {
    return this.context;
    };
    __Canvas_Canvas.prototype.__class__.getContext = function() {
        return __Canvas_Canvas.prototype.getContext.call.apply(__Canvas_Canvas.prototype.getContext, arguments);
    };
    __Canvas_Canvas.prototype.__class__.getContext.unbound_method = true;
    __Canvas_Canvas.prototype.getContext.instance_method = true;
    __Canvas_Canvas.prototype.isEmulation = function() {

        return (typeof $wnd.G_vmlCanvasManager != "undefined");
        
    };
    __Canvas_Canvas.prototype.__class__.isEmulation = function() {
        return __Canvas_Canvas.prototype.isEmulation.call.apply(__Canvas_Canvas.prototype.isEmulation, arguments);
    };
    __Canvas_Canvas.prototype.__class__.isEmulation.unbound_method = true;
    __Canvas_Canvas.prototype.isEmulation.instance_method = true;
    __Canvas_Canvas.prototype.init = function() {

        var el = this.getElement().firstChild;
        if (typeof $wnd.G_vmlCanvasManager != "undefined") {
            var parent = el.parent;
            
            el = $wnd.G_vmlCanvasManager.fixElement_(el);
            el.getContext = function () {
                if (this.context_) {
                    return this.context_;
                }
                return this.context_ = new $wnd.CanvasRenderingContext2D(el);
            };
        
            el.attachEvent("onpropertychange", function (e) {
                // we need to watch changes to width and height
                switch (e.propertyName) {
                    case "width":
                    case "height":
                    // coord size changed?
                    break;
                }
            });

            // if style.height is set
            
            var attrs = el.attributes;
            if (attrs.width && attrs.width.specified) {
                // TODO: use runtimeStyle and coordsize
                // el.getContext().setWidth_(attrs.width.nodeValue);
                el.style.width = attrs.width.nodeValue + "px";
            }
            if (attrs.height && attrs.height.specified) {
                // TODO: use runtimeStyle and coordsize
                // el.getContext().setHeight_(attrs.height.nodeValue);
                el.style.height = attrs.height.nodeValue + "px";
            }
        }
        var ctx = el.getContext("2d");
        
        ctx._createPattern = ctx.createPattern;
        ctx.createPattern = function(img, rep) {
            if (!(img instanceof Image)) img = img.getElement(); 
            return this._createPattern(img, rep);
            }

        ctx._drawImage = ctx.drawImage;
        ctx.drawImage = function() {
            var a=arguments;
            if (!(a[0] instanceof Image)) a[0] = a[0].getElement();
            if (a.length==9) return this._drawImage(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
            else if (a.length==5) return this._drawImage(a[0], a[1], a[2], a[3], a[4]);
            return this._drawImage(a[0], a[1], a[2]);
            }
        
        this.context = ctx;
        
    };
    __Canvas_Canvas.prototype.__class__.init = function() {
        return __Canvas_Canvas.prototype.init.call.apply(__Canvas_Canvas.prototype.init, arguments);
    };
    __Canvas_Canvas.prototype.__class__.init.unbound_method = true;
    __Canvas_Canvas.prototype.init.instance_method = true;
}
function __Canvas_CanvasImage() {
}
function Canvas_CanvasImage(url, load_listener) {
    if (typeof url == 'undefined') url='';
    if (typeof load_listener == 'undefined') load_listener=null;
    var instance = new __Canvas_CanvasImage();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


Canvas_CanvasImage.parse_kwargs = function ( __kwargs, url, load_listener ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    if (typeof load_listener == 'undefined')
        load_listener=__kwargs.load_listener;
    var __r = [url, load_listener];
    return __r;
};
function __Canvas_CanvasImage_initialize() {
    if(__Canvas_CanvasImage.__was_initialized__) return;
    __Canvas_CanvasImage.__was_initialized__ = true;
    if(!__ui_Image.__was_initialized__)
        __ui_Image_initialize();
    pyjs_extend(__Canvas_CanvasImage, __ui_Image);
    __Canvas_CanvasImage.prototype.__class__.__new__ = Canvas_CanvasImage;
    __Canvas_CanvasImage.prototype.__init__ = function(url, load_listener) {
    if (typeof url == 'undefined') url='';
    if (typeof load_listener == 'undefined') load_listener=null;
    __ui_Image.prototype.__class__.__init__(this, url);
    if (load_listener) {
    this.addLoadListener(load_listener);
    }
    this.onAttach();
    };
__Canvas_CanvasImage.prototype.__init__.parse_kwargs = function ( __kwargs, url, load_listener ) {
    if (typeof url == 'undefined')
        url=__kwargs.url;
    if (typeof load_listener == 'undefined')
        load_listener=__kwargs.load_listener;
    var __r = [url, load_listener];
    return __r;
};
    __Canvas_CanvasImage.prototype.__class__.__init__ = function() {
        return __Canvas_CanvasImage.prototype.__init__.call.apply(__Canvas_CanvasImage.prototype.__init__, arguments);
    };
    __Canvas_CanvasImage.prototype.__class__.__init__.unbound_method = true;
    __Canvas_CanvasImage.prototype.__init__.instance_method = true;
    __Canvas_CanvasImage.prototype.__class__.__init__.parse_kwargs = __Canvas_CanvasImage.prototype.__init__.parse_kwargs;
    __Canvas_CanvasImage.prototype.isLoaded = function() {
    return this.getElement().complete;
    };
    __Canvas_CanvasImage.prototype.__class__.isLoaded = function() {
        return __Canvas_CanvasImage.prototype.isLoaded.call.apply(__Canvas_CanvasImage.prototype.isLoaded, arguments);
    };
    __Canvas_CanvasImage.prototype.__class__.isLoaded.unbound_method = true;
    __Canvas_CanvasImage.prototype.isLoaded.instance_method = true;
}
function __Canvas_ImageLoadListener() {
}
function Canvas_ImageLoadListener(listener) {
    if (typeof listener == 'undefined') listener=null;
    var instance = new __Canvas_ImageLoadListener();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


Canvas_ImageLoadListener.parse_kwargs = function ( __kwargs, listener ) {
    if (typeof listener == 'undefined')
        listener=__kwargs.listener;
    var __r = [listener];
    return __r;
};
function __Canvas_ImageLoadListener_initialize() {
    if(__Canvas_ImageLoadListener.__was_initialized__) return;
    __Canvas_ImageLoadListener.__was_initialized__ = true;
    pyjs_extend(__Canvas_ImageLoadListener, __pyjslib_Object);
    __Canvas_ImageLoadListener.prototype.__class__.__new__ = Canvas_ImageLoadListener;
    __Canvas_ImageLoadListener.prototype.__init__ = function(listener) {
    if (typeof listener == 'undefined') listener=null;
    this.wait_list = new pyjslib_List([]);
    this.loadListeners = new pyjslib_List([]);
    if (listener) {
    this.addLoadListener(listener);
    }
    };
__Canvas_ImageLoadListener.prototype.__init__.parse_kwargs = function ( __kwargs, listener ) {
    if (typeof listener == 'undefined')
        listener=__kwargs.listener;
    var __r = [listener];
    return __r;
};
    __Canvas_ImageLoadListener.prototype.__class__.__init__ = function() {
        return __Canvas_ImageLoadListener.prototype.__init__.call.apply(__Canvas_ImageLoadListener.prototype.__init__, arguments);
    };
    __Canvas_ImageLoadListener.prototype.__class__.__init__.unbound_method = true;
    __Canvas_ImageLoadListener.prototype.__init__.instance_method = true;
    __Canvas_ImageLoadListener.prototype.__class__.__init__.parse_kwargs = __Canvas_ImageLoadListener.prototype.__init__.parse_kwargs;
    __Canvas_ImageLoadListener.prototype.add = function(sender) {
    this.wait_list.append(sender);
    sender.addLoadListener(this);
    };
    __Canvas_ImageLoadListener.prototype.__class__.add = function() {
        return __Canvas_ImageLoadListener.prototype.add.call.apply(__Canvas_ImageLoadListener.prototype.add, arguments);
    };
    __Canvas_ImageLoadListener.prototype.__class__.add.unbound_method = true;
    __Canvas_ImageLoadListener.prototype.add.instance_method = true;
    __Canvas_ImageLoadListener.prototype.addLoadListener = function(listener) {
    this.loadListeners.append(listener);
    };
    __Canvas_ImageLoadListener.prototype.__class__.addLoadListener = function() {
        return __Canvas_ImageLoadListener.prototype.addLoadListener.call.apply(__Canvas_ImageLoadListener.prototype.addLoadListener, arguments);
    };
    __Canvas_ImageLoadListener.prototype.__class__.addLoadListener.unbound_method = true;
    __Canvas_ImageLoadListener.prototype.addLoadListener.instance_method = true;
    __Canvas_ImageLoadListener.prototype.isLoaded = function() {
    if (pyjslib_len(this.wait_list)) {
    return false;
    }
    return true;
    };
    __Canvas_ImageLoadListener.prototype.__class__.isLoaded = function() {
        return __Canvas_ImageLoadListener.prototype.isLoaded.call.apply(__Canvas_ImageLoadListener.prototype.isLoaded, arguments);
    };
    __Canvas_ImageLoadListener.prototype.__class__.isLoaded.unbound_method = true;
    __Canvas_ImageLoadListener.prototype.isLoaded.instance_method = true;
    __Canvas_ImageLoadListener.prototype.onError = function(sender) {

        var __listener = this.loadListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onError(sender);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __Canvas_ImageLoadListener.prototype.__class__.onError = function() {
        return __Canvas_ImageLoadListener.prototype.onError.call.apply(__Canvas_ImageLoadListener.prototype.onError, arguments);
    };
    __Canvas_ImageLoadListener.prototype.__class__.onError.unbound_method = true;
    __Canvas_ImageLoadListener.prototype.onError.instance_method = true;
    __Canvas_ImageLoadListener.prototype.onLoad = function(sender) {
    this.wait_list.remove(sender);
    if (this.isLoaded()) {

        var __listener = this.loadListeners.__iter__();
        try {
            while (true) {
                var listener = __listener.next();
                
        
    listener.onLoad(this);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    };
    __Canvas_ImageLoadListener.prototype.__class__.onLoad = function() {
        return __Canvas_ImageLoadListener.prototype.onLoad.call.apply(__Canvas_ImageLoadListener.prototype.onLoad, arguments);
    };
    __Canvas_ImageLoadListener.prototype.__class__.onLoad.unbound_method = true;
    __Canvas_ImageLoadListener.prototype.onLoad.instance_method = true;
}
__Canvas_CanvasImage_initialize();
__Canvas_Canvas_initialize();
__Canvas_ImageLoadListener_initialize();
    var Timer_timers = new pyjslib_List([]);
function __Timer_Timer() {
}
function Timer_Timer(delay, object) {
    if (typeof delay == 'undefined') delay=0;
    if (typeof object == 'undefined') object=null;
    var instance = new __Timer_Timer();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


Timer_Timer.parse_kwargs = function ( __kwargs, delay, object ) {
    if (typeof delay == 'undefined')
        delay=__kwargs.delay;
    if (typeof object == 'undefined')
        object=__kwargs.object;
    var __r = [delay, object];
    return __r;
};
function __Timer_Timer_initialize() {
    if(__Timer_Timer.__was_initialized__) return;
    __Timer_Timer.__was_initialized__ = true;
    pyjs_extend(__Timer_Timer, __pyjslib_Object);
    __Timer_Timer.prototype.__class__.__new__ = Timer_Timer;
    __Timer_Timer.prototype.__class__.MIN_PERIOD = 1;
    __Timer_Timer.prototype.__init__ = function(delay, object) {
    if (typeof delay == 'undefined') delay=0;
    if (typeof object == 'undefined') object=null;
    this.isRepeating = false;
    this.timerId = 0;
    this.listener = object;
    if ((delay >= __Timer_Timer.prototype.__class__.MIN_PERIOD)) {
    this.schedule(delay);
    }
    };
__Timer_Timer.prototype.__init__.parse_kwargs = function ( __kwargs, delay, object ) {
    if (typeof delay == 'undefined')
        delay=__kwargs.delay;
    if (typeof object == 'undefined')
        object=__kwargs.object;
    var __r = [delay, object];
    return __r;
};
    __Timer_Timer.prototype.__class__.__init__ = function() {
        return __Timer_Timer.prototype.__init__.call.apply(__Timer_Timer.prototype.__init__, arguments);
    };
    __Timer_Timer.prototype.__class__.__init__.unbound_method = true;
    __Timer_Timer.prototype.__init__.instance_method = true;
    __Timer_Timer.prototype.__class__.__init__.parse_kwargs = __Timer_Timer.prototype.__init__.parse_kwargs;
    __Timer_Timer.prototype.clearInterval = function(id) {

        $wnd.clearInterval(id);
        
    };
    __Timer_Timer.prototype.__class__.clearInterval = function() {
        return __Timer_Timer.prototype.clearInterval.call.apply(__Timer_Timer.prototype.clearInterval, arguments);
    };
    __Timer_Timer.prototype.__class__.clearInterval.unbound_method = true;
    __Timer_Timer.prototype.clearInterval.instance_method = true;
    __Timer_Timer.prototype.clearTimeout = function(id) {

        $wnd.clearTimeout(id);
        
    };
    __Timer_Timer.prototype.__class__.clearTimeout = function() {
        return __Timer_Timer.prototype.clearTimeout.call.apply(__Timer_Timer.prototype.clearTimeout, arguments);
    };
    __Timer_Timer.prototype.__class__.clearTimeout.unbound_method = true;
    __Timer_Timer.prototype.clearTimeout.instance_method = true;
    __Timer_Timer.prototype.createInterval = function(timer, period) {

        return $wnd.setInterval(function() { timer.fire(); }, period);
        
    };
    __Timer_Timer.prototype.__class__.createInterval = function() {
        return __Timer_Timer.prototype.createInterval.call.apply(__Timer_Timer.prototype.createInterval, arguments);
    };
    __Timer_Timer.prototype.__class__.createInterval.unbound_method = true;
    __Timer_Timer.prototype.createInterval.instance_method = true;
    __Timer_Timer.prototype.createTimeout = function(timer, delay) {

        return $wnd.setTimeout(function() { timer.fire(); }, delay);
        
    };
    __Timer_Timer.prototype.__class__.createTimeout = function() {
        return __Timer_Timer.prototype.createTimeout.call.apply(__Timer_Timer.prototype.createTimeout, arguments);
    };
    __Timer_Timer.prototype.__class__.createTimeout.unbound_method = true;
    __Timer_Timer.prototype.createTimeout.instance_method = true;
    __Timer_Timer.prototype.hookWindowClosing = function() {
    };
    __Timer_Timer.prototype.__class__.hookWindowClosing = function() {
        return __Timer_Timer.prototype.hookWindowClosing.call.apply(__Timer_Timer.prototype.hookWindowClosing, arguments);
    };
    __Timer_Timer.prototype.__class__.hookWindowClosing.unbound_method = true;
    __Timer_Timer.prototype.hookWindowClosing.instance_method = true;
    __Timer_Timer.prototype.cancel = function() {
    if (this.isRepeating) {
    this.clearInterval(this.timerId);
    }
    else {
    this.clearTimeout(this.timerId);
    }
    Timer_timers.remove(this);
    };
    __Timer_Timer.prototype.__class__.cancel = function() {
        return __Timer_Timer.prototype.cancel.call.apply(__Timer_Timer.prototype.cancel, arguments);
    };
    __Timer_Timer.prototype.__class__.cancel.unbound_method = true;
    __Timer_Timer.prototype.cancel.instance_method = true;
    __Timer_Timer.prototype.run = function() {
    if (this.listener) {
    this.listener.onTimer(this.timerId);
    }
    };
    __Timer_Timer.prototype.__class__.run = function() {
        return __Timer_Timer.prototype.run.call.apply(__Timer_Timer.prototype.run, arguments);
    };
    __Timer_Timer.prototype.__class__.run.unbound_method = true;
    __Timer_Timer.prototype.run.instance_method = true;
    __Timer_Timer.prototype.schedule = function(delayMillis) {
    if ((delayMillis < __Timer_Timer.prototype.__class__.MIN_PERIOD)) {
    alert('Timer delay must be positive');
    }
    this.cancel();
    this.isRepeating = false;
    this.timerId = this.createTimeout(this, delayMillis);
    Timer_timers.append(this);
    };
    __Timer_Timer.prototype.__class__.schedule = function() {
        return __Timer_Timer.prototype.schedule.call.apply(__Timer_Timer.prototype.schedule, arguments);
    };
    __Timer_Timer.prototype.__class__.schedule.unbound_method = true;
    __Timer_Timer.prototype.schedule.instance_method = true;
    __Timer_Timer.prototype.scheduleRepeating = function(periodMillis) {
    if ((periodMillis < __Timer_Timer.prototype.__class__.MIN_PERIOD)) {
    alert('Timer period must be positive');
    }
    this.cancel();
    this.isRepeating = true;
    this.timerId = this.createInterval(this, periodMillis);
    Timer_timers.append(this);
    };
    __Timer_Timer.prototype.__class__.scheduleRepeating = function() {
        return __Timer_Timer.prototype.scheduleRepeating.call.apply(__Timer_Timer.prototype.scheduleRepeating, arguments);
    };
    __Timer_Timer.prototype.__class__.scheduleRepeating.unbound_method = true;
    __Timer_Timer.prototype.scheduleRepeating.instance_method = true;
    __Timer_Timer.prototype.fire = function() {
    this.fireImpl();
    };
    __Timer_Timer.prototype.__class__.fire = function() {
        return __Timer_Timer.prototype.fire.call.apply(__Timer_Timer.prototype.fire, arguments);
    };
    __Timer_Timer.prototype.__class__.fire.unbound_method = true;
    __Timer_Timer.prototype.fire.instance_method = true;
    __Timer_Timer.prototype.fireImpl = function() {
    if (!(this.isRepeating)) {
    Timer_timers.remove(this);
    }
    this.run();
    };
    __Timer_Timer.prototype.__class__.fireImpl = function() {
        return __Timer_Timer.prototype.fireImpl.call.apply(__Timer_Timer.prototype.fireImpl, arguments);
    };
    __Timer_Timer.prototype.__class__.fireImpl.unbound_method = true;
    __Timer_Timer.prototype.fireImpl.instance_method = true;
    __Timer_Timer.prototype.getID = function() {
    return this.timerId;
    };
    __Timer_Timer.prototype.__class__.getID = function() {
        return __Timer_Timer.prototype.getID.call.apply(__Timer_Timer.prototype.getID, arguments);
    };
    __Timer_Timer.prototype.__class__.getID.unbound_method = true;
    __Timer_Timer.prototype.getID.instance_method = true;
}
__Timer_Timer_initialize();

var math_ceil = Math.ceil;
var math_fabs = Math.abs;
var math_floor = Math.floor;
var math_exp = Math.exp;
var math_log = Math.log;
var math_pow = Math.pow;
var math_sqrt = Math.sqrt;
var math_cos = Math.cos;
var math_sin = Math.sin;
var math_tan = Math.tan;
var math_acos = Math.acos;
var math_asin = Math.asin;
var math_atan = Math.atan;
var math_atan2 = Math.atan2;

var math_pi = Math.PI;
var math_e = Math.E;


//
// BEGIN sprintf.js
//

// args is a pyjslib_List
// str is a String
function sprintf2(str, args)
{
   if(args && args.__class__ != "pyjslib_List")
      args = new pyjslib_List([args]);
   if (!args || pyjslib_len(args) < 1 || !RegExp)
   {
      return;
   }
   var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
   var a = b = [], numSubstitutions = 0, numMatches = 0;
   while (a = re.exec(str))
   {
      var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
      var pPrecision = a[5], pType = a[6], rightPart = a[7];
      
      //alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision);

      numMatches++;
      if (pType == '%')
      {
         subst = '%';
      }
      else
      {
         if (numSubstitutions >= args.length)
         {
            alert('Error! Not enough function args (' + (args.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).');
         }
         var param = args.__getitem__(numSubstitutions);
         var pad = '';
                if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1);
           else if (pPad) pad = pPad;
         var justifyRight = true;
                if (pJustify && pJustify === "-") justifyRight = false;
         var minLength = -1;
                if (pMinLength) minLength = parseInt(pMinLength);
         var precision = -1;
                if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1));
         var subst = param;
                if (pType == 'b') subst = parseInt(param).toString(2);
           else if (pType == 'c') subst = String.fromCharCode(parseInt(param));
           else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0;
           else if (pType == 'u') subst = Math.abs(param);
           else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param);
           else if (pType == 'o') subst = parseInt(param).toString(8);
           else if (pType == 's') subst = param;
           else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase();
           else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase();
         numSubstitutions++;
      }
      str = leftpart + subst + rightPart;
   }
   return str;
}

/**
*
*  Javascript sprintf
*  http://www.webtoolkit.info/
*
*
**/

// str is a String
// args is a pyjslib_List or pyjslib_Tuple
sprintfWrapper = {

	init : function (str, args) {

        if (args === undefined)
        {
            return null;
        }
        constructor = null;
        if (!pyjslib_is_basetype(args))
            constructor = pyjslib_get_pyjs_classtype(args);

        if(constructor != "pyjslib_List" && constructor != "pyjslib_Tuple")
        {
            args = new pyjslib_List([args]);
        }

       if (pyjslib_len(args) < 1 || !RegExp)
       {
          return null;
       }

		var exp = new RegExp(/(%([%]|(\-)?(\+|\x20)?(0)?(\d+)?(\.(\d)?)?([bcdfosxX])))/g);
		var matches = new Array();
		var strings = new Array();
		var convCount = 0;
		var stringPosStart = 0;
		var stringPosEnd = 0;
		var matchPosEnd = 0;
		var newString = '';
		var match = null;

		while (match = exp.exec(str)) {
			if (match[9]) { convCount += 1; }

			stringPosStart = matchPosEnd;
			stringPosEnd = exp.lastIndex - match[0].length;
			strings[strings.length] = str.substring(stringPosStart, stringPosEnd);
         var param = args.__getitem__(convCount-1);

			matchPosEnd = exp.lastIndex;
			matches[matches.length] = {
				match: match[0],
				left: match[3] ? true : false,
				sign: match[4] || '',
				pad: match[5] || ' ',
				min: match[6] || 0,
				precision: match[8],
				code: match[9] || '%',
				negative: parseInt(param) < 0 ? true : false,
				argument: String(param)
			};
		}
		strings[strings.length] = str.substring(matchPosEnd);

		if (matches.length == 0) { return str; }
		if ((args.length - 1) < convCount) { return null; }

		var code = null;
		var match = null;
		var i = null;

		for (i=0; i<matches.length; i++) {

			if (matches[i].code == '%') { substitution = '%' }
			else if (matches[i].code == 'b') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(2));
				substitution = sprintfWrapper.convert(matches[i], true);
			}
			else if (matches[i].code == 'c') {
				matches[i].argument = String(String.fromCharCode(parseInt(Math.abs(parseInt(matches[i].argument)))));
				substitution = sprintfWrapper.convert(matches[i], true);
			}
			else if (matches[i].code == 'd') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 'f') {
				matches[i].argument = String(Math.abs(parseFloat(matches[i].argument)).toFixed(matches[i].precision ? matches[i].precision : 6));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 'o') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(8));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 's') {
				matches[i].argument = String(matches[i].argument)
				matches[i].argument = matches[i].argument.substring(0, matches[i].precision ? matches[i].precision : matches[i].argument.length)
				substitution = sprintfWrapper.convert(matches[i], true);
			}
			else if (matches[i].code == 'x') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 'X') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16));
				substitution = sprintfWrapper.convert(matches[i]).toUpperCase();
			}
			else {
				substitution = matches[i].match;
			}

			newString += strings[i];
			newString += substitution;

		}
		newString += strings[i];

		return newString;

	},

	convert : function(match, nosign){
		if (nosign) {
			match.sign = '';
		} else {
			match.sign = match.negative ? '-' : match.sign;
		}
		var l = match.min - match.argument.length + 1 - match.sign.length;
		var pad = new Array(l < 0 ? 0 : l).join(match.pad);
		if (!match.left) {
			if (match.pad == "0" || nosign) {
				return match.sign + pad + match.argument;
			} else {
				return pad + match.sign + match.argument;
			}
		} else {
			if (match.pad == "0" || nosign) {
				return match.sign + match.argument + pad.replace(/0/g, ' ');
			} else {
				return match.sign + match.argument + pad;
			}
		}
	}
}

sprintf = sprintfWrapper.init;

//
// END sprintf.js
//
function Widgets_navLanguage() {

       if (navigator.userLanguage)
        return navigator.userLanguage.substring(0, 2);
       if (navigator.language) 
        return navigator.language.substring(0, 2);
       return 'en';
       
}


function __Widgets_Calendar() {
}
function Widgets_Calendar(visible, text, textbox, date, dateSep, firstDayOfWeek, backColor, autoHide) {
    if (typeof visible == 'undefined') visible=false;
    if (typeof text == 'undefined') text='';
    if (typeof textbox == 'undefined') textbox=null;
    if (typeof date == 'undefined') date=null;
    if (typeof dateSep == 'undefined') dateSep='-';
    if (typeof firstDayOfWeek == 'undefined') firstDayOfWeek=1;
    if (typeof backColor == 'undefined') backColor='#D4D0C8';
    if (typeof autoHide == 'undefined') autoHide=true;
    var instance = new __Widgets_Calendar();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


Widgets_Calendar.parse_kwargs = function ( __kwargs, visible, text, textbox, date, dateSep, firstDayOfWeek, backColor, autoHide ) {
    if (typeof visible == 'undefined')
        visible=__kwargs.visible;
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof textbox == 'undefined')
        textbox=__kwargs.textbox;
    if (typeof date == 'undefined')
        date=__kwargs.date;
    if (typeof dateSep == 'undefined')
        dateSep=__kwargs.dateSep;
    if (typeof firstDayOfWeek == 'undefined')
        firstDayOfWeek=__kwargs.firstDayOfWeek;
    if (typeof backColor == 'undefined')
        backColor=__kwargs.backColor;
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    var __r = [visible, text, textbox, date, dateSep, firstDayOfWeek, backColor, autoHide];
    return __r;
};
function __Widgets_Calendar_initialize() {
    if(__Widgets_Calendar.__was_initialized__) return;
    __Widgets_Calendar.__was_initialized__ = true;
    if(!__ui_FocusPanel.__was_initialized__)
        __ui_FocusPanel_initialize();
    pyjs_extend(__Widgets_Calendar, __ui_FocusPanel);
    __Widgets_Calendar.prototype.__class__.__new__ = Widgets_Calendar;
    __Widgets_Calendar.prototype.__class__.daysLabels_es = new pyjslib_List(['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab']);
    __Widgets_Calendar.prototype.__class__.monthsNames_es = new pyjslib_List(['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Setiembre', 'Octubre', 'Noviembre', 'Diciembre']);
    __Widgets_Calendar.prototype.__class__.daysLabels_en = new pyjslib_List(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']);
    __Widgets_Calendar.prototype.__class__.monthsNames_en = new pyjslib_List(['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
    __Widgets_Calendar.prototype.__class__.monthsDays = new pyjslib_List([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]);
    __Widgets_Calendar.prototype.__class__.daysLabels = new pyjslib_Dict([['es', __Widgets_Calendar.prototype.__class__.daysLabels_es], ['en', __Widgets_Calendar.prototype.__class__.daysLabels_en]]);
    __Widgets_Calendar.prototype.__class__.monthsNames = new pyjslib_Dict([['es', __Widgets_Calendar.prototype.__class__.monthsNames_es], ['en', __Widgets_Calendar.prototype.__class__.monthsNames_en]]);
    __Widgets_Calendar.prototype.__class__.otherLabels = new pyjslib_Dict([['es', new pyjslib_Dict([['lblToday', 'Hoy'], ['lblClose', 'Cerrar'], ['ttBack10y', 'Atr\xc3\xa1s 10 a\xc3\xb1os'], ['ttBack1y', 'Atr\xc3\xa1s 1 a\xc3\xb1o'], ['ttBack1m', 'Atr\xc3\xa1s mes'], ['ttFwd1m', 'Adelante 1 mes'], ['ttFwd1y', 'Adelante 1 a\xc3\xb1o'], ['ttFwd10y', 'Adelante 10 a\xc3\xb1os']])], ['en', new pyjslib_Dict([['lblToday', 'Today'], ['lblClose', 'Close'], ['ttBack10y', 'Back 10 years'], ['ttBack1y', 'Back 1 year'], ['ttBack1m', 'Back 1 month'], ['ttFwd1m', 'Forward 1 month'], ['ttFwd1y', 'Forward 1 year'], ['ttFwd10y', 'Forward 10 years']])]]);
    __Widgets_Calendar.prototype.isLeapYear = function() {
    if (this.year % 4) {
    return false;
    }
    if (!(this.year % 100)) {
    if (!(this.year % 400)) {
    return true;
    }
    else {
    return false;
    }
    }
    else {
    return true;
    }
    };
    __Widgets_Calendar.prototype.__class__.isLeapYear = function() {
        return __Widgets_Calendar.prototype.isLeapYear.call.apply(__Widgets_Calendar.prototype.isLeapYear, arguments);
    };
    __Widgets_Calendar.prototype.__class__.isLeapYear.unbound_method = true;
    __Widgets_Calendar.prototype.isLeapYear.instance_method = true;
    __Widgets_Calendar.prototype.setPopupPosition = function(left, top) {
    if ((left < 0)) {
    var left = 0;
    }
    if ((top < 0)) {
    var top = 0;
    }
    var element = this.getElement();
    DOM_setStyleAttribute(element, 'left',  ( left + 'px' ) );
    DOM_setStyleAttribute(element, 'top',  ( top + 'px' ) );
    };
    __Widgets_Calendar.prototype.__class__.setPopupPosition = function() {
        return __Widgets_Calendar.prototype.setPopupPosition.call.apply(__Widgets_Calendar.prototype.setPopupPosition, arguments);
    };
    __Widgets_Calendar.prototype.__class__.setPopupPosition.unbound_method = true;
    __Widgets_Calendar.prototype.setPopupPosition.instance_method = true;
    __Widgets_Calendar.prototype.onMouseDown = function(sender, x, y) {
    if ((sender == this.lblCurrentMonthYear)) {
    this.dragging = true;
    DOM_setCapture(this.lblCurrentMonthYear.getElement());
    this.dragStartX = x;
    this.dragStartY = y;
    }
    else {
    __ui_FocusPanel.prototype.__class__.onMouseDown(this, sender, x, y);
    }
    };
    __Widgets_Calendar.prototype.__class__.onMouseDown = function() {
        return __Widgets_Calendar.prototype.onMouseDown.call.apply(__Widgets_Calendar.prototype.onMouseDown, arguments);
    };
    __Widgets_Calendar.prototype.__class__.onMouseDown.unbound_method = true;
    __Widgets_Calendar.prototype.onMouseDown.instance_method = true;
    __Widgets_Calendar.prototype.onMouseEnter = function(sender) {
    };
    __Widgets_Calendar.prototype.__class__.onMouseEnter = function() {
        return __Widgets_Calendar.prototype.onMouseEnter.call.apply(__Widgets_Calendar.prototype.onMouseEnter, arguments);
    };
    __Widgets_Calendar.prototype.__class__.onMouseEnter.unbound_method = true;
    __Widgets_Calendar.prototype.onMouseEnter.instance_method = true;
    __Widgets_Calendar.prototype.onMouseLeave = function(sender) {
    };
    __Widgets_Calendar.prototype.__class__.onMouseLeave = function() {
        return __Widgets_Calendar.prototype.onMouseLeave.call.apply(__Widgets_Calendar.prototype.onMouseLeave, arguments);
    };
    __Widgets_Calendar.prototype.__class__.onMouseLeave.unbound_method = true;
    __Widgets_Calendar.prototype.onMouseLeave.instance_method = true;
    __Widgets_Calendar.prototype.onMouseMove = function(sender, x, y) {
    if (this.dragging) {
    var absX =  ( x + this.getAbsoluteLeft() ) ;
    var absY =  ( y + this.getAbsoluteTop() ) ;
    this.setPopupPosition( ( absX - this.dragStartX ) ,  ( absY - this.dragStartY ) );
    }
    };
    __Widgets_Calendar.prototype.__class__.onMouseMove = function() {
        return __Widgets_Calendar.prototype.onMouseMove.call.apply(__Widgets_Calendar.prototype.onMouseMove, arguments);
    };
    __Widgets_Calendar.prototype.__class__.onMouseMove.unbound_method = true;
    __Widgets_Calendar.prototype.onMouseMove.instance_method = true;
    __Widgets_Calendar.prototype.onMouseUp = function(sender, x, y) {
    if ((sender == this.lblCurrentMonthYear)) {
    this.dragging = false;
    DOM_releaseCapture(this.lblCurrentMonthYear.getElement());
    }
    else {
    __ui_FocusPanel.prototype.__class__.onMouseUp(this, sender, x, y);
    }
    };
    __Widgets_Calendar.prototype.__class__.onMouseUp = function() {
        return __Widgets_Calendar.prototype.onMouseUp.call.apply(__Widgets_Calendar.prototype.onMouseUp, arguments);
    };
    __Widgets_Calendar.prototype.__class__.onMouseUp.unbound_method = true;
    __Widgets_Calendar.prototype.onMouseUp.instance_method = true;
    __Widgets_Calendar.prototype.__init__ = function(visible, text, textbox, date, dateSep, firstDayOfWeek, backColor, autoHide) {
    if (typeof visible == 'undefined') visible=false;
    if (typeof text == 'undefined') text='';
    if (typeof textbox == 'undefined') textbox=null;
    if (typeof date == 'undefined') date=null;
    if (typeof dateSep == 'undefined') dateSep='-';
    if (typeof firstDayOfWeek == 'undefined') firstDayOfWeek=1;
    if (typeof backColor == 'undefined') backColor='#D4D0C8';
    if (typeof autoHide == 'undefined') autoHide=true;
    __ui_FocusPanel.prototype.__class__.__init__(this);
    this.monthsNames = __Widgets_Calendar.prototype.__class__.monthsNames.__getitem__(Widgets_navLanguage());
    this.daysLabels = __Widgets_Calendar.prototype.__class__.daysLabels.__getitem__(Widgets_navLanguage());
    this.otherLabels = __Widgets_Calendar.prototype.__class__.otherLabels.__getitem__(Widgets_navLanguage());
    this.monthChanged = true;
    this.dragging = false;
    this.dragStartX = 0;
    this.dragStartY = 0;
    this.year = 0;
    this.month = 0;
    this.day = 0;
    this.dayOfWeek = 0;
    this.fdomDayOfWeek = 0;
    this.todayYear = 0;
    this.todayMonth = 0;
    this.todayDay = 0;
    if ((firstDayOfWeek > 1)) {
    var firstDayOfWeek = 1;
    }
    if ((firstDayOfWeek < 0)) {
    var firstDayOfWeek = 0;
    }
    this.firstDayOfWeek = firstDayOfWeek;
    this.dateSep = dateSep;
    this.text = text;
    this.textbox = textbox;
    this.backColor = backColor;
    this.autoHide = autoHide;
    this.setWidth('19%');
    this.vp = ui_VerticalPanel();
    this.titlePanel = ui_HorizontalPanel();
    var fp = ui_FocusPanel();
    fp.addMouseListener(TooltipListener(this.otherLabels.__getitem__('ttBack10y')));
    this.btnBack10Years = ui_Button('&lt;&lt;&lt;', pyjslib_getattr(this, 'minus10Years'));
    fp.add(this.btnBack10Years);
    this.titlePanel.add(fp);
    var fp = ui_FocusPanel();
    fp.addMouseListener(TooltipListener(this.otherLabels.__getitem__('ttBack1y')));
    this.btnBackYear = ui_Button('&lt;&lt;', pyjslib_getattr(this, 'minusYear'));
    fp.add(this.btnBackYear);
    this.titlePanel.add(fp);
    var fp = ui_FocusPanel();
    fp.addMouseListener(TooltipListener(this.otherLabels.__getitem__('ttBack1m')));
    this.btnBackMonth = ui_Button('&lt;', pyjslib_getattr(this, 'minusMonth'));
    fp.add(this.btnBackMonth);
    this.titlePanel.add(fp);
    this.lblCurrentMonthYear = Label('');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'marginLeft', '1px');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'marginRight', '1px');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'paddingLeft', '10px');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'paddingRight', '10px');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'color', '#0D4B70');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'backgroundColor', 'rgb(255,255,255)');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'fontSize', 'small');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'cursor', 'move');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'width', '8em');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'textAlign', 'center');
    DOM_setStyleAttribute(this.lblCurrentMonthYear.getElement(), 'verticalAlign', 'middle');
    this.titlePanel.add(this.lblCurrentMonthYear);
    var fp = ui_FocusPanel();
    fp.addMouseListener(TooltipListener(this.otherLabels.__getitem__('ttFwd1m')));
    this.btnNextMonth = ui_Button('&gt;', pyjslib_getattr(this, 'plusMonth'));
    fp.add(this.btnNextMonth);
    this.titlePanel.add(fp);
    var fp = ui_FocusPanel();
    fp.addMouseListener(TooltipListener(this.otherLabels.__getitem__('ttFwd1y')));
    this.btnNextYear = ui_Button('&gt;&gt;', pyjslib_getattr(this, 'plusYear'));
    fp.add(this.btnNextYear);
    this.titlePanel.add(fp);
    var fp = ui_FocusPanel();
    fp.addMouseListener(TooltipListener(this.otherLabels.__getitem__('ttFwd10y')));
    this.btnNext10Years = ui_Button('&gt;&gt;&gt;', pyjslib_getattr(this, 'plus10Years'));
    fp.add(this.btnNext10Years);
    this.titlePanel.add(fp);
    this.vp.add(this.titlePanel);
    this.daysPanel = SimplePanel();
    this.vp.add(this.daysPanel);
    var proxy = this;
function autoCerrar() {
    proxy.setVisible(false);
}


function irAHoy() {
    var strDate = sprintf('%d%s%d%s%d', new pyjslib_Tuple([proxy.todayYear, proxy.dateSep,  ( proxy.todayMonth + 1 ) , proxy.dateSep, proxy.todayDay]));
    if (((proxy.todayMonth != proxy.month)) || ((proxy.todayYear != proxy.year))) {
    proxy.monthChanged = true;
    }
    proxy.setDate(strDate);
}


    var id1 = __ui_HTMLPanel.prototype.__class__.createUniqueId();
    var id2 = __ui_HTMLPanel.prototype.__class__.createUniqueId();
    this.bottomPanel = ui_HTMLPanel( (  (  (  ( '<div style=\'text-align: right;\'><span id=' + id2 )  + '><span id=' )  + id1 )  + '></div>' ) );
    this.btnToday = ui_Button(this.otherLabels.__getitem__('lblToday'), irAHoy);
    this.bottomPanel.add(this.btnToday, id1);
    this.btnClose = ui_Button(this.otherLabels.__getitem__('lblClose'), autoCerrar);
    this.bottomPanel.add(this.btnClose, id2);
    this.btnToday.setWidth('50%');
    this.btnClose.setWidth('50%');
    this.vp.add(this.bottomPanel);
    DOM_setStyleAttribute(this.vp.getElement(), 'border', '1px solid');
    DOM_setStyleAttribute(this.vp.getElement(), 'padding', '2px');
    this.setDate(date);

           var d = new Date()
           var todayYear = d.getYear()
           if (todayYear < 1900)
            todayYear += 1900;
           var todayMonth = d.getMonth();
           var todayDay = d.getDate();
           var todayDayOfWeek = d.getDay();
           
    this.todayYear = todayYear;
    this.todayMonth = todayMonth;
    this.todayDay = todayDay;
    this.todayDayOfWeek = todayDayOfWeek;
    DOM_setStyleAttribute(this.vp.getElement(), 'backgroundColor', this.backColor);
    this.setWidget(this.vp);
    var wi = this.vp.getOffsetWidth();
    DOM_setStyleAttribute(this.getElement(), 'position', 'absolute');
    this.lblCurrentMonthYear.addMouseListener(this);
    this.setVisible(visible);
    };
__Widgets_Calendar.prototype.__init__.parse_kwargs = function ( __kwargs, visible, text, textbox, date, dateSep, firstDayOfWeek, backColor, autoHide ) {
    if (typeof visible == 'undefined')
        visible=__kwargs.visible;
    if (typeof text == 'undefined')
        text=__kwargs.text;
    if (typeof textbox == 'undefined')
        textbox=__kwargs.textbox;
    if (typeof date == 'undefined')
        date=__kwargs.date;
    if (typeof dateSep == 'undefined')
        dateSep=__kwargs.dateSep;
    if (typeof firstDayOfWeek == 'undefined')
        firstDayOfWeek=__kwargs.firstDayOfWeek;
    if (typeof backColor == 'undefined')
        backColor=__kwargs.backColor;
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    var __r = [visible, text, textbox, date, dateSep, firstDayOfWeek, backColor, autoHide];
    return __r;
};
    __Widgets_Calendar.prototype.__class__.__init__ = function() {
        return __Widgets_Calendar.prototype.__init__.call.apply(__Widgets_Calendar.prototype.__init__, arguments);
    };
    __Widgets_Calendar.prototype.__class__.__init__.unbound_method = true;
    __Widgets_Calendar.prototype.__init__.instance_method = true;
    __Widgets_Calendar.prototype.__class__.__init__.parse_kwargs = __Widgets_Calendar.prototype.__init__.parse_kwargs;
    __Widgets_Calendar.prototype.setDestination = function(textbox) {
    this.textbox = textbox;
    };
    __Widgets_Calendar.prototype.__class__.setDestination = function() {
        return __Widgets_Calendar.prototype.setDestination.call.apply(__Widgets_Calendar.prototype.setDestination, arguments);
    };
    __Widgets_Calendar.prototype.__class__.setDestination.unbound_method = true;
    __Widgets_Calendar.prototype.setDestination.instance_method = true;
    __Widgets_Calendar.prototype._rechargeDate = function() {
    var strDate = sprintf('%d%s%d%s%d', new pyjslib_Tuple([this.year, this.dateSep,  ( this.month + 1 ) , this.dateSep, this.day]));
    this.setDate(strDate);
    };
    __Widgets_Calendar.prototype.__class__._rechargeDate = function() {
        return __Widgets_Calendar.prototype._rechargeDate.call.apply(__Widgets_Calendar.prototype._rechargeDate, arguments);
    };
    __Widgets_Calendar.prototype.__class__._rechargeDate.unbound_method = true;
    __Widgets_Calendar.prototype._rechargeDate.instance_method = true;
    __Widgets_Calendar.prototype.plus10Years = function() {
    this.year += 10;
    this.monthChanged = true;
    this._rechargeDate();
    };
    __Widgets_Calendar.prototype.__class__.plus10Years = function() {
        return __Widgets_Calendar.prototype.plus10Years.call.apply(__Widgets_Calendar.prototype.plus10Years, arguments);
    };
    __Widgets_Calendar.prototype.__class__.plus10Years.unbound_method = true;
    __Widgets_Calendar.prototype.plus10Years.instance_method = true;
    __Widgets_Calendar.prototype.plusYear = function() {
    this.year += 1;
    this.monthChanged = true;
    this._rechargeDate();
    };
    __Widgets_Calendar.prototype.__class__.plusYear = function() {
        return __Widgets_Calendar.prototype.plusYear.call.apply(__Widgets_Calendar.prototype.plusYear, arguments);
    };
    __Widgets_Calendar.prototype.__class__.plusYear.unbound_method = true;
    __Widgets_Calendar.prototype.plusYear.instance_method = true;
    __Widgets_Calendar.prototype.minus10Years = function() {
    this.year -= 10;
    this.monthChanged = true;
    this._rechargeDate();
    };
    __Widgets_Calendar.prototype.__class__.minus10Years = function() {
        return __Widgets_Calendar.prototype.minus10Years.call.apply(__Widgets_Calendar.prototype.minus10Years, arguments);
    };
    __Widgets_Calendar.prototype.__class__.minus10Years.unbound_method = true;
    __Widgets_Calendar.prototype.minus10Years.instance_method = true;
    __Widgets_Calendar.prototype.minusYear = function() {
    this.year -= 1;
    this.monthChanged = true;
    this._rechargeDate();
    };
    __Widgets_Calendar.prototype.__class__.minusYear = function() {
        return __Widgets_Calendar.prototype.minusYear.call.apply(__Widgets_Calendar.prototype.minusYear, arguments);
    };
    __Widgets_Calendar.prototype.__class__.minusYear.unbound_method = true;
    __Widgets_Calendar.prototype.minusYear.instance_method = true;
    __Widgets_Calendar.prototype.plusMonth = function() {
    this.month += 1;
    if ((this.month > 11)) {
    this.year += 1;
    this.month = 0;
    }
    this.monthChanged = true;
    this._rechargeDate();
    };
    __Widgets_Calendar.prototype.__class__.plusMonth = function() {
        return __Widgets_Calendar.prototype.plusMonth.call.apply(__Widgets_Calendar.prototype.plusMonth, arguments);
    };
    __Widgets_Calendar.prototype.__class__.plusMonth.unbound_method = true;
    __Widgets_Calendar.prototype.plusMonth.instance_method = true;
    __Widgets_Calendar.prototype.minusMonth = function() {
    this.month -= 1;
    if ((this.month < 0)) {
    this.month = 11;
    this.year -= 1;
    }
    this.monthChanged = true;
    this._rechargeDate();
    };
    __Widgets_Calendar.prototype.__class__.minusMonth = function() {
        return __Widgets_Calendar.prototype.minusMonth.call.apply(__Widgets_Calendar.prototype.minusMonth, arguments);
    };
    __Widgets_Calendar.prototype.__class__.minusMonth.unbound_method = true;
    __Widgets_Calendar.prototype.minusMonth.instance_method = true;
    __Widgets_Calendar.prototype.doSomething = function(sender) {
    if (this.textbox) {
    var btnvalue = sender.getText();
    var texto = sprintf('%s %d', new pyjslib_Tuple([this.toString(), btnvalue]));
    this.textbox.setText(texto);
    }
    this.setVisible(false);
    };
    __Widgets_Calendar.prototype.__class__.doSomething = function() {
        return __Widgets_Calendar.prototype.doSomething.call.apply(__Widgets_Calendar.prototype.doSomething, arguments);
    };
    __Widgets_Calendar.prototype.__class__.doSomething.unbound_method = true;
    __Widgets_Calendar.prototype.doSomething.instance_method = true;
    __Widgets_Calendar.prototype.setDate = function(date) {
    var year = null;
    var month = null;
    var day = null;
    var dayOfWeek = null;
    if (!(date)) {

               date = new Date();
               year = date.getYear();
               if (year < 1900)
                year += 1900;
               month = date.getMonth();
               day = date.getDate();
               dayOfWeek = date.getDay();
               
    }
    else {
    var arr = date.split(this.dateSep);
    var year = pyjslib_int(arr.__getitem__(0));
    var month =  ( pyjslib_int(arr.__getitem__(1)) - 1 ) ;
    var day = pyjslib_int(arr.__getitem__(2));

               newdate = new Date(year, month, day);
               dayOfWeek = newdate.getDay();
               
    }
    this.year = year;
    this.month = month;
    this.day = day;
    this.dayOfWeek = dayOfWeek;

           d = new Date(year, month, 1)
           var fdow = d.getDay();
           
    fdow -= this.firstDayOfWeek;
    if ((fdow < 0)) {
    var fdow =  ( pyjslib_len(this.daysLabels) + fdow ) ;
    }
    this.fdomDayOfWeek = fdow;
    if (this.monthChanged) {
    this.drawDays();
    this.monthChanged = false;
    }
    this.paintDays();
    this.lblCurrentMonthYear.setText(sprintf('%s %d', new pyjslib_Tuple([this.monthsNames.__getitem__(this.month), this.year])));
    if (this.textbox) {
    this.textbox.setText(this.toString());
    }
    };
    __Widgets_Calendar.prototype.__class__.setDate = function() {
        return __Widgets_Calendar.prototype.setDate.call.apply(__Widgets_Calendar.prototype.setDate, arguments);
    };
    __Widgets_Calendar.prototype.__class__.setDate.unbound_method = true;
    __Widgets_Calendar.prototype.setDate.instance_method = true;
    __Widgets_Calendar.prototype.drawDays = function() {
    var totalDays = this.getTotalDrawDays();
    var rows =  ( totalDays / 7 ) ;
    if (totalDays % 7) {
    rows += 1;
    }
    var cols = 7;
    this.grid = Grid( ( rows + 1 ) , cols);
    var grid = this.grid;
    grid.setWidth('100%');
    var cellformatter = grid.getCellFormatter();
    DOM_setAttribute(grid.getElement(), 'border', '1');
    DOM_setStyleAttribute(grid.getElement(), 'borderCollapse', 'collapse');
    DOM_setStyleAttribute(grid.getElement(), 'cursor', 'pointer');
    grid.addTableListener(this);
    DOM_setStyleAttribute(grid.getElement(), 'backgroundColor', this.backColor);

        var __c = pyjslib_range(this.firstDayOfWeek, cols).__iter__();
        try {
            while (true) {
                var c = __c.next();
                
        
    grid.setText(0,  ( c - this.firstDayOfWeek ) , this.daysLabels.__getitem__(c));
    DOM_setStyleAttribute(cellformatter.getElement(0,  ( c - this.firstDayOfWeek ) ), 'backgroundColor', '#0D4B70');
    DOM_setStyleAttribute(cellformatter.getElement(0,  ( c - this.firstDayOfWeek ) ), 'color', 'white');
    DOM_setStyleAttribute(cellformatter.getElement(0,  ( c - this.firstDayOfWeek ) ), 'textAlign', 'center');
    DOM_setStyleAttribute(cellformatter.getElement(0,  ( c - this.firstDayOfWeek ) ), 'fontFamily', 'Courier');

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    if (this.firstDayOfWeek) {

        var __c = pyjslib_range(0, this.firstDayOfWeek).__iter__();
        try {
            while (true) {
                var c = __c.next();
                
        
    grid.setText(0,  (  ( c + cols )  - 1 ) , this.daysLabels.__getitem__(c));
    DOM_setStyleAttribute(cellformatter.getElement(0,  (  ( c + cols )  - 1 ) ), 'backgroundColor', '#0D4B70');
    DOM_setStyleAttribute(cellformatter.getElement(0,  (  ( c + cols )  - 1 ) ), 'color', 'white');
    DOM_setStyleAttribute(cellformatter.getElement(0,  (  ( c + cols )  - 1 ) ), 'textAlign', 'center');
    DOM_setStyleAttribute(cellformatter.getElement(0,  (  ( c + cols )  - 1 ) ), 'fontFamily', 'Courier');

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    }
    var counter = 0;

        var __r = pyjslib_range(1,  ( rows + 1 ) ).__iter__();
        try {
            while (true) {
                var r = __r.next();
                
        

        var __c = pyjslib_range(cols).__iter__();
        try {
            while (true) {
                var c = __c.next();
                
        
    if (((counter < this.fdomDayOfWeek)) || ((counter >= totalDays))) {
    grid.setText(r, c, '');
    }
    else {
    grid.setText(r, c, pyjslib_str( (  ( counter + 1 )  - this.fdomDayOfWeek ) ));
    DOM_setStyleAttribute(cellformatter.getElement(r, c), 'textAlign', 'center');
    }
    counter += 1;

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    this.daysPanel.setWidget(grid);
    };
    __Widgets_Calendar.prototype.__class__.drawDays = function() {
        return __Widgets_Calendar.prototype.drawDays.call.apply(__Widgets_Calendar.prototype.drawDays, arguments);
    };
    __Widgets_Calendar.prototype.__class__.drawDays.unbound_method = true;
    __Widgets_Calendar.prototype.drawDays.instance_method = true;
    __Widgets_Calendar.prototype.paintDays = function() {
    var formatter = this.grid.getCellFormatter();

        var __r = pyjslib_range(1, this.grid.getRowCount()).__iter__();
        try {
            while (true) {
                var r = __r.next();
                
        

        var __c = pyjslib_range(7).__iter__();
        try {
            while (true) {
                var c = __c.next();
                
        
    var texto = this.grid.getText(r, c);
    if ((texto != '')) {
    var num = pyjslib_int(texto);
    if ((num == this.day)) {
    DOM_setStyleAttribute(formatter.getElement(r, c), 'backgroundColor', 'white');
    }
    else {
    if (((num == this.todayDay)) && ((this.month == this.todayMonth)) && ((this.year == this.todayYear))) {
    DOM_setStyleAttribute(formatter.getElement(r, c), 'color', 'white');
    DOM_setStyleAttribute(formatter.getElement(r, c), 'backgroundColor', 'rgb(0,192,0)');
    }
    else {
    DOM_setStyleAttribute(formatter.getElement(r, c), 'color', 'black');
    DOM_setStyleAttribute(formatter.getElement(r, c), 'backgroundColor', this.backColor);
    }
    }
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __Widgets_Calendar.prototype.__class__.paintDays = function() {
        return __Widgets_Calendar.prototype.paintDays.call.apply(__Widgets_Calendar.prototype.paintDays, arguments);
    };
    __Widgets_Calendar.prototype.__class__.paintDays.unbound_method = true;
    __Widgets_Calendar.prototype.paintDays.instance_method = true;
    __Widgets_Calendar.prototype.onCellClicked = function(grid, row, col) {
    var texto = grid.getText(row, col);
    if (((texto == '')) || ((row == 0))) {
    return;
    }
    this.day = pyjslib_int(texto);
    this._rechargeDate();
    if (this.autoHide) {
    this.setVisible(false);
    }
    };
    __Widgets_Calendar.prototype.__class__.onCellClicked = function() {
        return __Widgets_Calendar.prototype.onCellClicked.call.apply(__Widgets_Calendar.prototype.onCellClicked, arguments);
    };
    __Widgets_Calendar.prototype.__class__.onCellClicked.unbound_method = true;
    __Widgets_Calendar.prototype.onCellClicked.instance_method = true;
    __Widgets_Calendar.prototype.getTotalDrawDays = function() {
    var monthDays = __Widgets_Calendar.prototype.__class__.monthsDays.__getitem__(this.month);
    if ((this.isLeapYear()) && ((this.month == 1))) {
    monthDays += 1;
    }
    monthDays += this.fdomDayOfWeek;
    return monthDays;
    };
    __Widgets_Calendar.prototype.__class__.getTotalDrawDays = function() {
        return __Widgets_Calendar.prototype.getTotalDrawDays.call.apply(__Widgets_Calendar.prototype.getTotalDrawDays, arguments);
    };
    __Widgets_Calendar.prototype.__class__.getTotalDrawDays.unbound_method = true;
    __Widgets_Calendar.prototype.getTotalDrawDays.instance_method = true;
    __Widgets_Calendar.prototype.toString = function() {
    return sprintf('%d%s%0.2d%s%0.2d', new pyjslib_Tuple([this.year, this.dateSep,  ( this.month + 1 ) , this.dateSep, this.day]));
    };
    __Widgets_Calendar.prototype.__class__.toString = function() {
        return __Widgets_Calendar.prototype.toString.call.apply(__Widgets_Calendar.prototype.toString, arguments);
    };
    __Widgets_Calendar.prototype.__class__.toString.unbound_method = true;
    __Widgets_Calendar.prototype.toString.instance_method = true;
    __Widgets_Calendar.prototype.__str__ = function() {
    return this.__repr__();
    };
    __Widgets_Calendar.prototype.__class__.__str__ = function() {
        return __Widgets_Calendar.prototype.__str__.call.apply(__Widgets_Calendar.prototype.__str__, arguments);
    };
    __Widgets_Calendar.prototype.__class__.__str__.unbound_method = true;
    __Widgets_Calendar.prototype.__str__.instance_method = true;
}
function __Widgets_SolarCanvas() {
}
function Widgets_SolarCanvas(img_url) {
    var instance = new __Widgets_SolarCanvas();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __Widgets_SolarCanvas_initialize() {
    if(__Widgets_SolarCanvas.__was_initialized__) return;
    __Widgets_SolarCanvas.__was_initialized__ = true;
    if(!__Canvas_Canvas.__was_initialized__)
        __Canvas_Canvas_initialize();
    pyjs_extend(__Widgets_SolarCanvas, __Canvas_Canvas);
    __Widgets_SolarCanvas.prototype.__class__.__new__ = Widgets_SolarCanvas;
    __Widgets_SolarCanvas.prototype.__init__ = function(img_url) {
    __Canvas_Canvas.prototype.__class__.__init__(this, 200, 200);
    this.clock = Canvas_CanvasImage(img_url);
    this.width = 100;
    this.height = 100;
    this.loader = Canvas_ImageLoadListener(this);
    this.loader.add(this.clock);
    this.isActive = true;
    this.onTimer();
    };
    __Widgets_SolarCanvas.prototype.__class__.__init__ = function() {
        return __Widgets_SolarCanvas.prototype.__init__.call.apply(__Widgets_SolarCanvas.prototype.__init__, arguments);
    };
    __Widgets_SolarCanvas.prototype.__class__.__init__.unbound_method = true;
    __Widgets_SolarCanvas.prototype.__init__.instance_method = true;
    __Widgets_SolarCanvas.prototype.onLoad = function() {
    var el = this.clock.getElement();
    this.width = DOM_getAttribute(el, 'width');
    this.height = DOM_getIntAttribute(el, 'height');
    this.setWidth(sprintf('%dpx', this.width));
    this.setHeight(sprintf('%dpx', this.height));
    };
    __Widgets_SolarCanvas.prototype.__class__.onLoad = function() {
        return __Widgets_SolarCanvas.prototype.onLoad.call.apply(__Widgets_SolarCanvas.prototype.onLoad, arguments);
    };
    __Widgets_SolarCanvas.prototype.__class__.onLoad.unbound_method = true;
    __Widgets_SolarCanvas.prototype.onLoad.instance_method = true;
    __Widgets_SolarCanvas.prototype.onTimer = function() {
    if (!(this.isActive)) {
    return;
    }
    Timer_Timer(1000, this);
    this.draw();
    };
    __Widgets_SolarCanvas.prototype.__class__.onTimer = function() {
        return __Widgets_SolarCanvas.prototype.onTimer.call.apply(__Widgets_SolarCanvas.prototype.onTimer, arguments);
    };
    __Widgets_SolarCanvas.prototype.__class__.onTimer.unbound_method = true;
    __Widgets_SolarCanvas.prototype.onTimer.instance_method = true;
    __Widgets_SolarCanvas.prototype.getTimeSeconds = function() {

        var x = new Date();
        return x.getSeconds();
        
    };
    __Widgets_SolarCanvas.prototype.__class__.getTimeSeconds = function() {
        return __Widgets_SolarCanvas.prototype.getTimeSeconds.call.apply(__Widgets_SolarCanvas.prototype.getTimeSeconds, arguments);
    };
    __Widgets_SolarCanvas.prototype.__class__.getTimeSeconds.unbound_method = true;
    __Widgets_SolarCanvas.prototype.getTimeSeconds.instance_method = true;
    __Widgets_SolarCanvas.prototype.getTimeMinutes = function() {

        var x = new Date();
        return x.getMinutes();
        
    };
    __Widgets_SolarCanvas.prototype.__class__.getTimeMinutes = function() {
        return __Widgets_SolarCanvas.prototype.getTimeMinutes.call.apply(__Widgets_SolarCanvas.prototype.getTimeMinutes, arguments);
    };
    __Widgets_SolarCanvas.prototype.__class__.getTimeMinutes.unbound_method = true;
    __Widgets_SolarCanvas.prototype.getTimeMinutes.instance_method = true;
    __Widgets_SolarCanvas.prototype.getTimeHours = function() {

        var x = new Date();
        return x.getHours();
        
    };
    __Widgets_SolarCanvas.prototype.__class__.getTimeHours = function() {
        return __Widgets_SolarCanvas.prototype.getTimeHours.call.apply(__Widgets_SolarCanvas.prototype.getTimeHours, arguments);
    };
    __Widgets_SolarCanvas.prototype.__class__.getTimeHours.unbound_method = true;
    __Widgets_SolarCanvas.prototype.getTimeHours.instance_method = true;
    __Widgets_SolarCanvas.prototype.getTimeMilliseconds = function() {

        var x = new Date();
        return x.getMilliseconds();
        
    };
    __Widgets_SolarCanvas.prototype.__class__.getTimeMilliseconds = function() {
        return __Widgets_SolarCanvas.prototype.getTimeMilliseconds.call.apply(__Widgets_SolarCanvas.prototype.getTimeMilliseconds, arguments);
    };
    __Widgets_SolarCanvas.prototype.__class__.getTimeMilliseconds.unbound_method = true;
    __Widgets_SolarCanvas.prototype.getTimeMilliseconds.instance_method = true;
    __Widgets_SolarCanvas.prototype.draw = function() {
    var pi = 3.14159265359;
    if (!(this.loader.isLoaded())) {
    return;
    }
    this.context.globalCompositeOperation = 'destination-over';
    this.context.clearRect(0, 0, this.width, this.height);
    this.context.save();
    this.context.fillStyle = 'rgba(0,0,0,0.4)';
    this.context.strokeStyle = 'rgba(0,153,255,0.4)';
    this.context.translate( ( this.width / 2 ) ,  ( this.height / 2 ) );
    var secs = this.getTimeSeconds();
    var mins =  ( this.getTimeMinutes() +  ( secs / 60.0 )  ) ;
    var hours =  ( this.getTimeHours() +  ( mins / 60.0 )  ) ;
    this.context.save();
    this.context.fillStyle = 'rgba(255,0,0,0.4)';
    this.context.rotate( (  (  (  ( 2 * pi )  / 60 )  * secs )  + pi ) );
    this.context.fillRect(-1, - ( this.width * 0.04 ) , 2,  ( this.width * 0.38 ) );
    this.context.restore();
    this.context.save();
    this.context.rotate( (  (  (  ( 2 * pi )  / 60 )  * mins )  + pi ) );
    this.context.fillRect(-1, -1, 3,  ( this.width * 0.35 ) );
    this.context.restore();
    this.context.save();
    this.context.rotate( (  (  (  ( 2 * pi )  / 12 )  * hours )  + pi ) );
    this.context.fillRect(-2, -2, 4,  ( this.width * 0.2 ) );
    this.context.restore();
    this.context.restore();
    this.context.drawImage(this.clock, 0, 0);
    };
    __Widgets_SolarCanvas.prototype.__class__.draw = function() {
        return __Widgets_SolarCanvas.prototype.draw.call.apply(__Widgets_SolarCanvas.prototype.draw, arguments);
    };
    __Widgets_SolarCanvas.prototype.__class__.draw.unbound_method = true;
    __Widgets_SolarCanvas.prototype.draw.instance_method = true;
}
function __Widgets_RoundPanel() {
}
function Widgets_RoundPanel(html, borderColor, bgColor, cornerSize) {
    if (typeof borderColor == 'undefined') borderColor=null;
    if (typeof bgColor == 'undefined') bgColor='#ffffff';
    if (typeof cornerSize == 'undefined') cornerSize='small';
    var instance = new __Widgets_RoundPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


Widgets_RoundPanel.parse_kwargs = function ( __kwargs, html, borderColor, bgColor, cornerSize ) {
    if (typeof borderColor == 'undefined')
        borderColor=__kwargs.borderColor;
    if (typeof bgColor == 'undefined')
        bgColor=__kwargs.bgColor;
    if (typeof cornerSize == 'undefined')
        cornerSize=__kwargs.cornerSize;
    var __r = [html, borderColor, bgColor, cornerSize];
    return __r;
};
function __Widgets_RoundPanel_initialize() {
    if(__Widgets_RoundPanel.__was_initialized__) return;
    __Widgets_RoundPanel.__was_initialized__ = true;
    if(!__ui_HTMLPanel.__was_initialized__)
        __ui_HTMLPanel_initialize();
    pyjs_extend(__Widgets_RoundPanel, __ui_HTMLPanel);
    __Widgets_RoundPanel.prototype.__class__.__new__ = Widgets_RoundPanel;
    __Widgets_RoundPanel.prototype.__init__ = function(html, borderColor, bgColor, cornerSize) {
    if (typeof borderColor == 'undefined') borderColor=null;
    if (typeof bgColor == 'undefined') bgColor='#ffffff';
    if (typeof cornerSize == 'undefined') cornerSize='small';
    if (!(borderColor)) {
    var borderColor = bgColor;
    }
    if ((cornerSize.lower() != 'small')) {
    var templ = '\n                <b class="b00f" style="border-color: @bc; background: @bc;"></b>\n                <b class="b0f" style="border-color: @bc; background: @bg;"></b>\n                <b class="b1f" style="border-color: @bc; background: @bg;"></b>\n            ';
    }
    else {
    var templ = '<b class="b1f" style="border-color: @bc; background: @bc;"></b>';
    }
    templ += '\n                <b class="b2f" style="border-color: @bc; background: @bg;"></b>\n                <b class="b3f" style="border-color: @bc; background: @bg;"></b>\n                <b class="b4f" style="border-color: @bc; background: @bg;"></b>\n                    <div class="contentf" style="border-color: @bc; background: @bg;">\n                        <div style="padding: 0.5em;">\n                            @2\n                        </div>\n                    </div>\n                <b class="b4f" style="border-color: @bc; background: @bg;"></b>\n                <b class="b3f" style="border-color: @bc; background: @bg;"></b>\n                <b class="b2f" style="border-color: @bc; background: @bg;"></b>\n            ';
    if ((cornerSize.lower() != 'small')) {
    templ += '\n                <b class="b1f" style="border-color: @bc; background: @bg;"></b>\n                <b class="b0f" style="border-color: @bc; background: @bg;"></b>\n                <b class="b00f" style="border-color: @bc; background: @bc;"></b>        \n            ';
    }
    else {
    templ += '<b class="b1f" style="border-color: @bc; background: @bc;"></b>';
    }
    var newhtml = templ.replace('@2', html);
    var newhtml = newhtml.replace('@bc', borderColor);
    var newhtml = newhtml.replace('@bg', bgColor);
    __ui_HTMLPanel.prototype.__class__.__init__(this, newhtml);
    };
__Widgets_RoundPanel.prototype.__init__.parse_kwargs = function ( __kwargs, html, borderColor, bgColor, cornerSize ) {
    if (typeof borderColor == 'undefined')
        borderColor=__kwargs.borderColor;
    if (typeof bgColor == 'undefined')
        bgColor=__kwargs.bgColor;
    if (typeof cornerSize == 'undefined')
        cornerSize=__kwargs.cornerSize;
    var __r = [html, borderColor, bgColor, cornerSize];
    return __r;
};
    __Widgets_RoundPanel.prototype.__class__.__init__ = function() {
        return __Widgets_RoundPanel.prototype.__init__.call.apply(__Widgets_RoundPanel.prototype.__init__, arguments);
    };
    __Widgets_RoundPanel.prototype.__class__.__init__.unbound_method = true;
    __Widgets_RoundPanel.prototype.__init__.instance_method = true;
    __Widgets_RoundPanel.prototype.__class__.__init__.parse_kwargs = __Widgets_RoundPanel.prototype.__init__.parse_kwargs;
}
__Widgets_RoundPanel_initialize();
__Widgets_Calendar_initialize();
__Widgets_SolarCanvas_initialize();
function __HTTPRequest_HTTPRequest() {
}
function HTTPRequest_HTTPRequest() {
    var instance = new __HTTPRequest_HTTPRequest();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __HTTPRequest_HTTPRequest_initialize() {
    if(__HTTPRequest_HTTPRequest.__was_initialized__) return;
    __HTTPRequest_HTTPRequest.__was_initialized__ = true;
    pyjs_extend(__HTTPRequest_HTTPRequest, __pyjslib_Object);
    __HTTPRequest_HTTPRequest.prototype.__class__.__new__ = HTTPRequest_HTTPRequest;
    __HTTPRequest_HTTPRequest.prototype.asyncPost = function(user, pwd, url, postData, handler) {
    if (typeof postData == 'undefined') postData=null;
    if (typeof handler == 'undefined') handler=null;
    if ((postData == null)) {
    return this.asyncPostImpl(null, null, user, pwd, url);
    }
    return this.asyncPostImpl(user, pwd, url, postData, handler);
    };
__HTTPRequest_HTTPRequest.prototype.asyncPost.parse_kwargs = function ( __kwargs, user, pwd, url, postData, handler ) {
    if (typeof postData == 'undefined')
        postData=__kwargs.postData;
    if (typeof handler == 'undefined')
        handler=__kwargs.handler;
    var __r = [user, pwd, url, postData, handler];
    return __r;
};
    __HTTPRequest_HTTPRequest.prototype.__class__.asyncPost = function() {
        return __HTTPRequest_HTTPRequest.prototype.asyncPost.call.apply(__HTTPRequest_HTTPRequest.prototype.asyncPost, arguments);
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.asyncPost.unbound_method = true;
    __HTTPRequest_HTTPRequest.prototype.asyncPost.instance_method = true;
    __HTTPRequest_HTTPRequest.prototype.__class__.asyncPost.parse_kwargs = __HTTPRequest_HTTPRequest.prototype.asyncPost.parse_kwargs;
    __HTTPRequest_HTTPRequest.prototype.asyncGet = function(user, pwd, url, handler) {
    if ((url == null)) {
    return this.asyncGetImpl(null, null, user, pwd);
    }
    return this.asyncGetImpl(user, pwd, url, handler);
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.asyncGet = function() {
        return __HTTPRequest_HTTPRequest.prototype.asyncGet.call.apply(__HTTPRequest_HTTPRequest.prototype.asyncGet, arguments);
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.asyncGet.unbound_method = true;
    __HTTPRequest_HTTPRequest.prototype.asyncGet.instance_method = true;
    __HTTPRequest_HTTPRequest.prototype.createXmlHTTPRequest = function() {
    return this.doCreateXmlHTTPRequest();
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.createXmlHTTPRequest = function() {
        return __HTTPRequest_HTTPRequest.prototype.createXmlHTTPRequest.call.apply(__HTTPRequest_HTTPRequest.prototype.createXmlHTTPRequest, arguments);
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.createXmlHTTPRequest.unbound_method = true;
    __HTTPRequest_HTTPRequest.prototype.createXmlHTTPRequest.instance_method = true;
    __HTTPRequest_HTTPRequest.prototype.doCreateXmlHTTPRequest = function() {

        return new XMLHttpRequest();
        
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.doCreateXmlHTTPRequest = function() {
        return __HTTPRequest_HTTPRequest.prototype.doCreateXmlHTTPRequest.call.apply(__HTTPRequest_HTTPRequest.prototype.doCreateXmlHTTPRequest, arguments);
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.doCreateXmlHTTPRequest.unbound_method = true;
    __HTTPRequest_HTTPRequest.prototype.doCreateXmlHTTPRequest.instance_method = true;
    __HTTPRequest_HTTPRequest.prototype.asyncPostImpl = function(user, pwd, url, postData, handler) {

        var xmlHttp = this.doCreateXmlHTTPRequest();
        try {
            xmlHttp.open("POST", url, true);
            xmlHttp.setRequestHeader("Content-Type",
                                           "application/x-www-form-urlencoded");
            xmlHttp.setRequestHeader("Content-Length", postData.length);
            xmlHttp.onreadystatechange = function() {
                if (xmlHttp.readyState == 4) {
                    delete xmlHttp.onreadystatechange;
                    var localHandler = handler;
                    var responseText = xmlHttp.responseText;
                    var status = xmlHttp.status;
                    handler = null;
                    xmlHttp = null;
                    if(status == 200) {
                        localHandler.onCompletion(responseText);
                    } else {
                        localHandler.onError(responseText, status);
                    }
                }
            };
            xmlHttp.send(postData);
            return true;
        }
        catch (e) {
            delete xmlHttp.onreadystatechange;
            var localHandler = handler;
            handler = null;
            xmlHttp = null;
            localHandler.onError(String(e));
            return false;
        }
        
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.asyncPostImpl = function() {
        return __HTTPRequest_HTTPRequest.prototype.asyncPostImpl.call.apply(__HTTPRequest_HTTPRequest.prototype.asyncPostImpl, arguments);
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.asyncPostImpl.unbound_method = true;
    __HTTPRequest_HTTPRequest.prototype.asyncPostImpl.instance_method = true;
    __HTTPRequest_HTTPRequest.prototype.asyncGetImpl = function(user, pwd, url, handler) {

        var xmlHttp = this.doCreateXmlHTTPRequest();
        try {
            xmlHttp.open("GET", url, true);
            xmlHttp.setRequestHeader("Content-Type", "text/plain; charset=utf-8");
            xmlHttp.onreadystatechange = function() {
                if (xmlHttp.readyState == 4) {
                    delete xmlHttp.onreadystatechange;
                    var localHandler = handler;
                    var responseText = xmlHttp.responseText;
                    var status = xmlHttp.status;
                    handler = null;
                    xmlHttp = null;
                    if(status == 200) {
                        localHandler.onCompletion(responseText);
                    } else {
                        localHandler.onError(responseText, status);
                    }
                }
            };
            xmlHttp.send('');
            return true;
        }
        catch (e) {
            delete xmlHttp.onreadystatechange;
            var localHandler = handler;
            handler = null;
            xmlHttp = null;
            localHandler.onError(String(e));
            return false;
        }
        
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.asyncGetImpl = function() {
        return __HTTPRequest_HTTPRequest.prototype.asyncGetImpl.call.apply(__HTTPRequest_HTTPRequest.prototype.asyncGetImpl, arguments);
    };
    __HTTPRequest_HTTPRequest.prototype.__class__.asyncGetImpl.unbound_method = true;
    __HTTPRequest_HTTPRequest.prototype.asyncGetImpl.instance_method = true;
}
__HTTPRequest_HTTPRequest_initialize();

/*
JSONEncode:
    +---------------+-------------------+---------------+
    | PYGWT         | Python            | JSON          |
    +===============+===================+===============+
    | pyjslib_Dict  | dict              | object        |
    +---------------+-------------------+---------------+
    | pyjslib_List  | list, tuple       | array         |
    +---------------+-------------------+---------------+
    | string        | str, unicode      | string        |
    +---------------+-------------------+---------------+
    | number        | int, long, float  | number        |
    +---------------+-------------------+---------------+
    | true          | True              | true          |
    +---------------+-------------------+---------------+
    | false         | False             | false         |
    +---------------+-------------------+---------------+
    | null          | None              | null          |
    +---------------+-------------------+---------------+


JSONDecode:
    +---------------+-------------------+--------------+
    | JSON          | Python            | PYGWT        |
    +===============+===================+==============+
    | object        | dict              | pyjslib_Dict |
    +---------------+-------------------+--------------+
    | array         | list              | pyjslib_List |
    +---------------+-------------------+--------------+
    | string        | unicode           | string       |
    +---------------+-------------------+--------------+
    | number (int)  | int, long         | number       |
    +---------------+-------------------+--------------+
    | number (real) | float             | number       |
    +---------------+-------------------+--------------+
    | true          | True              | true         |
    +---------------+-------------------+--------------+
    | false         | False             | false        |
    +---------------+-------------------+--------------+
    | null          | None              | null         |
    +---------------+-------------------+--------------+
*/

function __JSONParser_JSONParser() {
}
function JSONParser_JSONParser() {
    var instance = new __JSONParser_JSONParser();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __JSONParser_JSONParser_initialize() {
    if(__JSONParser_JSONParser.__was_initialized__) return;
    __JSONParser_JSONParser.__was_initialized__ = true;
    pyjs_extend(__JSONParser_JSONParser, __pyjslib_Object);
    __JSONParser_JSONParser.prototype.__class__.__new__ = JSONParser_JSONParser;
    __JSONParser_JSONParser.prototype.decode = function(str) {
    return this.jsObjectToPy(this.parseJSON(str));
    };
    __JSONParser_JSONParser.prototype.__class__.decode = function() {
        return __JSONParser_JSONParser.prototype.decode.call.apply(__JSONParser_JSONParser.prototype.decode, arguments);
    };
    __JSONParser_JSONParser.prototype.__class__.decode.unbound_method = true;
    __JSONParser_JSONParser.prototype.decode.instance_method = true;
    __JSONParser_JSONParser.prototype.decodeAsObject = function(str) {
    return this.jsObjectToPyObject(this.parseJSON(str));
    };
    __JSONParser_JSONParser.prototype.__class__.decodeAsObject = function() {
        return __JSONParser_JSONParser.prototype.decodeAsObject.call.apply(__JSONParser_JSONParser.prototype.decodeAsObject, arguments);
    };
    __JSONParser_JSONParser.prototype.__class__.decodeAsObject.unbound_method = true;
    __JSONParser_JSONParser.prototype.decodeAsObject.instance_method = true;
    __JSONParser_JSONParser.prototype.encode = function(obj) {
    return this.toJSONString(obj);
    };
    __JSONParser_JSONParser.prototype.__class__.encode = function() {
        return __JSONParser_JSONParser.prototype.encode.call.apply(__JSONParser_JSONParser.prototype.encode, arguments);
    };
    __JSONParser_JSONParser.prototype.__class__.encode.unbound_method = true;
    __JSONParser_JSONParser.prototype.encode.instance_method = true;
    __JSONParser_JSONParser.prototype.jsObjectToPy = function(obj) {

        if (pyjslib_isArray(obj)) {
            for (var i in obj) obj[i] = this.jsObjectToPy(obj[i]);
            obj=new pyjslib_List(obj);
            }
        else if (pyjslib_isObject(obj)) {
            for (var i in obj) obj[i]=this.jsObjectToPy(obj[i]);
            obj=new pyjslib_Dict(obj);
            }
        
        return obj;
        
    };
    __JSONParser_JSONParser.prototype.__class__.jsObjectToPy = function() {
        return __JSONParser_JSONParser.prototype.jsObjectToPy.call.apply(__JSONParser_JSONParser.prototype.jsObjectToPy, arguments);
    };
    __JSONParser_JSONParser.prototype.__class__.jsObjectToPy.unbound_method = true;
    __JSONParser_JSONParser.prototype.jsObjectToPy.instance_method = true;
    __JSONParser_JSONParser.prototype.jsObjectToPyObject = function(obj) {

        if (pyjslib_isArray(obj)) {
            for (var i in obj) obj[i] = this.jsObjectToPyObject(obj[i]);
            obj=new pyjslib_List(obj);
            }
        else if (pyjslib_isObject(obj)) {
            if (obj["__jsonclass__"]) {
                var class_name = obj["__jsonclass__"][0];
                class_name = class_name.replace(".", "_");
                
                var new_obj = eval("new " + class_name + "()");
                delete obj["__jsonclass__"];
                for (var i in obj) new_obj[i] = this.jsObjectToPyObject(obj[i]);
                obj = new_obj;
                }
            else {
                for (var i in obj) obj[i]=this.jsObjectToPyObject(obj[i]);
                obj=new pyjslib_Dict(obj);
                }       
            }
        
        return obj;
        
    };
    __JSONParser_JSONParser.prototype.__class__.jsObjectToPyObject = function() {
        return __JSONParser_JSONParser.prototype.jsObjectToPyObject.call.apply(__JSONParser_JSONParser.prototype.jsObjectToPyObject, arguments);
    };
    __JSONParser_JSONParser.prototype.__class__.jsObjectToPyObject.unbound_method = true;
    __JSONParser_JSONParser.prototype.jsObjectToPyObject.instance_method = true;
    __JSONParser_JSONParser.prototype.toJSONString = function(obj) {

   var m = {
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        },
        s = {
            array: function (x) {
                var a = ['['], b, f, i, l = x.length, v;
                for (i = 0; i < l; i += 1) {
                    v = x[i];
                    f = s[typeof v];
                    if (f) {
                        v = f(v);
                        if (typeof v == 'string') {
                            if (b) {
                                a[a.length] = ',';
                            }
                            a[a.length] = v;
                            b = true;
                        }
                    }
                }
                a[a.length] = ']';
                return a.join('');
            },
            'boolean': function (x) {
                return String(x);
            },
            'undefined':function (x) {
               return "null";
            },
            'null': function (x) {
                return "null";
            },
            number: function (x) {
                return isFinite(x) ? String(x) : 'null';
            },
            object: function (x) {
                if (x) {
                    if (x instanceof Array) {
                        return s.array(x);
                    }
                    if (x instanceof __pyjslib_List) {
                        return s.array(x.l);
                    }
                    if (x instanceof __pyjslib_Dict) {
                        return s.object(x.d);
                    }
                    var a = ['{'], b, f, i, v;
                    for (i in x) {
                        v = x[i];
                        f = s[typeof v];
                        if (f) {
                            v = f(v);
                            if (typeof v == 'string') {
                                if (b) {
                                    a[a.length] = ',';
                                }
                                a.push(s.string(i), ':', v);
                                b = true;
                            }
                        }
                    }
                    a[a.length] = '}';
                    return a.join('');
                }
                return 'null';
            },
            string: function (x) {
                if (/["\\\x00-\x1f]/.test(x)) {
                    x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
                        var c = m[b];
                        if (c) {
                            return c;
                        }
                        c = b.charCodeAt();
                        return '\\u00' +
                            Math.floor(c / 16).toString(16) +
                            (c % 16).toString(16);
                    });
                }
                return '"' + x + '"';
            }
        };

        f=s[typeof obj];
        return f(obj);
        
    };
    __JSONParser_JSONParser.prototype.__class__.toJSONString = function() {
        return __JSONParser_JSONParser.prototype.toJSONString.call.apply(__JSONParser_JSONParser.prototype.toJSONString, arguments);
    };
    __JSONParser_JSONParser.prototype.__class__.toJSONString.unbound_method = true;
    __JSONParser_JSONParser.prototype.toJSONString.instance_method = true;
    __JSONParser_JSONParser.prototype.parseJSON = function(str) {

        try {
            return (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(str)) &&
                eval('(' + str + ')');
        } catch (e) {
            return false;
        }
        
    };
    __JSONParser_JSONParser.prototype.__class__.parseJSON = function() {
        return __JSONParser_JSONParser.prototype.parseJSON.call.apply(__JSONParser_JSONParser.prototype.parseJSON, arguments);
    };
    __JSONParser_JSONParser.prototype.__class__.parseJSON.unbound_method = true;
    __JSONParser_JSONParser.prototype.parseJSON.instance_method = true;
}
__JSONParser_JSONParser_initialize();
function __CountryListBox_CountryListBox() {
}
function CountryListBox_CountryListBox() {
    var instance = new __CountryListBox_CountryListBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __CountryListBox_CountryListBox_initialize() {
    if(__CountryListBox_CountryListBox.__was_initialized__) return;
    __CountryListBox_CountryListBox.__was_initialized__ = true;
    if(!__ui_ListBox.__was_initialized__)
        __ui_ListBox_initialize();
    pyjs_extend(__CountryListBox_CountryListBox, __ui_ListBox);
    __CountryListBox_CountryListBox.prototype.__class__.__new__ = CountryListBox_CountryListBox;
    __CountryListBox_CountryListBox.prototype.__class__.country_list = new pyjslib_List([new pyjslib_List(['', '']), new pyjslib_List(['Afghanistan', 'AF']), new pyjslib_List(['\xc5fland Islands', 'AX']), new pyjslib_List(['Albania', 'AL']), new pyjslib_List(['Algeria', 'DZ']), new pyjslib_List(['American Samoa', 'AS']), new pyjslib_List(['Andorra', 'AD']), new pyjslib_List(['Angola', 'AO']), new pyjslib_List(['Anguilla', 'AI']), new pyjslib_List(['Antarctica', 'AQ']), new pyjslib_List(['Antigua And Barbuda', 'AG']), new pyjslib_List(['Argentina', 'AR']), new pyjslib_List(['Armenia', 'AM']), new pyjslib_List(['Aruba', 'AW']), new pyjslib_List(['Australia', 'AU']), new pyjslib_List(['Austria', 'AT']), new pyjslib_List(['Azerbaijan', 'AZ']), new pyjslib_List(['Bahamas', 'BS']), new pyjslib_List(['Bahrain', 'BH']), new pyjslib_List(['Bangladesh', 'BD']), new pyjslib_List(['Barbados', 'BB']), new pyjslib_List(['Belarus', 'BY']), new pyjslib_List(['Belgium', 'BE']), new pyjslib_List(['Belize', 'BZ']), new pyjslib_List(['Benin', 'BJ']), new pyjslib_List(['Bermuda', 'BM']), new pyjslib_List(['Bhutan', 'BT']), new pyjslib_List(['Bolivia', 'BO']), new pyjslib_List(['Bosnia And Herzegovina', 'BA']), new pyjslib_List(['Botswana', 'BW']), new pyjslib_List(['Bouvet Island', 'BV']), new pyjslib_List(['Brazil', 'BR']), new pyjslib_List(['British Indian Ocean Territory', 'IO']), new pyjslib_List(['Brunei Darussalam', 'BN']), new pyjslib_List(['Bulgaria', 'BG']), new pyjslib_List(['Burkina Faso', 'BF']), new pyjslib_List(['Burundi', 'BI']), new pyjslib_List(['Cambodia', 'KH']), new pyjslib_List(['Cameroon', 'CM']), new pyjslib_List(['Canada', 'CA']), new pyjslib_List(['Cape Verde', 'CV']), new pyjslib_List(['Cayman Islands', 'KY']), new pyjslib_List(['Central African Republic', 'CF']), new pyjslib_List(['Chad', 'TD']), new pyjslib_List(['Chile', 'CL']), new pyjslib_List(['China', 'CN']), new pyjslib_List(['Christmas Island', 'CX']), new pyjslib_List(['Cocos (keeling) Islands', 'CC']), new pyjslib_List(['Colombia', 'CO']), new pyjslib_List(['Comoros', 'KM']), new pyjslib_List(['Congo', 'CG']), new pyjslib_List(['Congo, The Democratic Republic Of The', 'CD']), new pyjslib_List(['Cook Islands', 'CK']), new pyjslib_List(['Costa Rica', 'CR']), new pyjslib_List(['Cote D\'ivoire', 'CI']), new pyjslib_List(['Croatia', 'HR']), new pyjslib_List(['Cuba', 'CU']), new pyjslib_List(['Cyprus', 'CY']), new pyjslib_List(['Czech Republic', 'CZ']), new pyjslib_List(['Denmark', 'DK']), new pyjslib_List(['Djibouti', 'DJ']), new pyjslib_List(['Dominica', 'DM']), new pyjslib_List(['Dominican Republic', 'DO']), new pyjslib_List(['Ecuador', 'EC']), new pyjslib_List(['Egypt', 'EG']), new pyjslib_List(['El Salvador', 'SV']), new pyjslib_List(['Equatorial Guinea', 'GQ']), new pyjslib_List(['Eritrea', 'ER']), new pyjslib_List(['Estonia', 'EE']), new pyjslib_List(['Ethiopia', 'ET']), new pyjslib_List(['Falkland Islands (malvinas)', 'FK']), new pyjslib_List(['Faroe Islands', 'FO']), new pyjslib_List(['Fiji', 'FJ']), new pyjslib_List(['Finland', 'FI']), new pyjslib_List(['France', 'FR']), new pyjslib_List(['French Guiana', 'GF']), new pyjslib_List(['French Polynesia', 'PF']), new pyjslib_List(['French Southern Territories', 'TF']), new pyjslib_List(['Gabon', 'GA']), new pyjslib_List(['Gambia', 'GM']), new pyjslib_List(['Georgia', 'GE']), new pyjslib_List(['Germany', 'DE']), new pyjslib_List(['Ghana', 'GH']), new pyjslib_List(['Gibraltar', 'GI']), new pyjslib_List(['Greece', 'GR']), new pyjslib_List(['Greenland', 'GL']), new pyjslib_List(['Grenada', 'GD']), new pyjslib_List(['Guadeloupe', 'GP']), new pyjslib_List(['Guam', 'GU']), new pyjslib_List(['Guatemala', 'GT']), new pyjslib_List(['Guernsey', 'GG']), new pyjslib_List(['Guinea', 'GN']), new pyjslib_List(['Guinea-bissau', 'GW']), new pyjslib_List(['Guyana', 'GY']), new pyjslib_List(['Haiti', 'HT']), new pyjslib_List(['Heard Island And Mcdonald Islands', 'HM']), new pyjslib_List(['Holy See (vatican City State)', 'VA']), new pyjslib_List(['Honduras', 'HN']), new pyjslib_List(['Hong Kong', 'HK']), new pyjslib_List(['Hungary', 'HU']), new pyjslib_List(['Iceland', 'IS']), new pyjslib_List(['India', 'IN']), new pyjslib_List(['Indonesia', 'ID']), new pyjslib_List(['Iran, Islamic Republic Of', 'IR']), new pyjslib_List(['Iraq', 'IQ']), new pyjslib_List(['Ireland', 'IE']), new pyjslib_List(['Isle Of Man', 'IM']), new pyjslib_List(['Israel', 'IL']), new pyjslib_List(['Italy', 'IT']), new pyjslib_List(['Jamaica', 'JM']), new pyjslib_List(['Japan', 'JP']), new pyjslib_List(['Jersey', 'JE']), new pyjslib_List(['Jordan', 'JO']), new pyjslib_List(['Kazakhstan', 'KZ']), new pyjslib_List(['Kenya', 'KE']), new pyjslib_List(['Kiribati', 'KI']), new pyjslib_List(['Korea, Democratic People\'s Republic Of', 'KP']), new pyjslib_List(['Korea, Republic Of', 'KR']), new pyjslib_List(['Kuwait', 'KW']), new pyjslib_List(['Kyrgyzstan', 'KG']), new pyjslib_List(['Lao People\'s Democratic Republic', 'LA']), new pyjslib_List(['Latvia', 'LV']), new pyjslib_List(['Lebanon', 'LB']), new pyjslib_List(['Lesotho', 'LS']), new pyjslib_List(['Liberia', 'LR']), new pyjslib_List(['Libyan Arab Jamahiriya', 'LY']), new pyjslib_List(['Liechtenstein', 'LI']), new pyjslib_List(['Lithuania', 'LT']), new pyjslib_List(['Luxembourg', 'LU']), new pyjslib_List(['Macao', 'MO']), new pyjslib_List(['Macedonia, The Former Yugoslav Republic Of', 'MK']), new pyjslib_List(['Madagascar', 'MG']), new pyjslib_List(['Malawi', 'MW']), new pyjslib_List(['Malaysia', 'MY']), new pyjslib_List(['Maldives', 'MV']), new pyjslib_List(['Mali', 'ML']), new pyjslib_List(['Malta', 'MT']), new pyjslib_List(['Marshall Islands', 'MH']), new pyjslib_List(['Martinique', 'MQ']), new pyjslib_List(['Mauritania', 'MR']), new pyjslib_List(['Mauritius', 'MU']), new pyjslib_List(['Mayotte', 'YT']), new pyjslib_List(['Mexico', 'MX']), new pyjslib_List(['Micronesia, Federated States Of', 'FM']), new pyjslib_List(['Moldova, Republic Of', 'MD']), new pyjslib_List(['Monaco', 'MC']), new pyjslib_List(['Mongolia', 'MN']), new pyjslib_List(['Montenegro', 'ME']), new pyjslib_List(['Montserrat', 'MS']), new pyjslib_List(['Morocco', 'MA']), new pyjslib_List(['Mozambique', 'MZ']), new pyjslib_List(['Myanmar', 'MM']), new pyjslib_List(['Namibia', 'NA']), new pyjslib_List(['Nauru', 'NR']), new pyjslib_List(['Nepal', 'NP']), new pyjslib_List(['Netherlands', 'NL']), new pyjslib_List(['Netherlands Antilles', 'AN']), new pyjslib_List(['New Caledonia', 'NC']), new pyjslib_List(['New Zealand', 'NZ']), new pyjslib_List(['Nicaragua', 'NI']), new pyjslib_List(['Niger', 'NE']), new pyjslib_List(['Nigeria', 'NG']), new pyjslib_List(['Niue', 'NU']), new pyjslib_List(['Norfolk Island', 'NF']), new pyjslib_List(['Northern Mariana Islands', 'MP']), new pyjslib_List(['Norway', 'NO']), new pyjslib_List(['Oman', 'OM']), new pyjslib_List(['Pakistan', 'PK']), new pyjslib_List(['Palau', 'PW']), new pyjslib_List(['Palestinian Territory, Occupied', 'PS']), new pyjslib_List(['Panama', 'PA']), new pyjslib_List(['Papua New Guinea', 'PG']), new pyjslib_List(['Paraguay', 'PY']), new pyjslib_List(['Peru', 'PE']), new pyjslib_List(['Philippines', 'PH']), new pyjslib_List(['Pitcairn', 'PN']), new pyjslib_List(['Poland', 'PL']), new pyjslib_List(['Portugal', 'PT']), new pyjslib_List(['Puerto Rico', 'PR']), new pyjslib_List(['Qatar', 'QA']), new pyjslib_List(['Reunion', 'RE']), new pyjslib_List(['Romania', 'RO']), new pyjslib_List(['Russian Federation', 'RU']), new pyjslib_List(['Rwanda', 'RW']), new pyjslib_List(['Saint Helena', 'SH']), new pyjslib_List(['Saint Kitts And Nevis', 'KN']), new pyjslib_List(['Saint Lucia', 'LC']), new pyjslib_List(['Saint Pierre And Miquelon', 'PM']), new pyjslib_List(['Saint Vincent And The Grenadines', 'VC']), new pyjslib_List(['Samoa', 'WS']), new pyjslib_List(['San Marino', 'SM']), new pyjslib_List(['Sao Tome And Principe', 'ST']), new pyjslib_List(['Saudi Arabia', 'SA']), new pyjslib_List(['Senegal', 'SN']), new pyjslib_List(['Serbia', 'RS']), new pyjslib_List(['Seychelles', 'SC']), new pyjslib_List(['Sierra Leone', 'SL']), new pyjslib_List(['Singapore', 'SG']), new pyjslib_List(['Slovakia', 'SK']), new pyjslib_List(['Slovenia', 'SI']), new pyjslib_List(['Solomon Islands', 'SB']), new pyjslib_List(['Somalia', 'SO']), new pyjslib_List(['South Africa', 'ZA']), new pyjslib_List(['South Georgia And The South Sandwich Islands', 'GS']), new pyjslib_List(['Spain', 'ES']), new pyjslib_List(['Sri Lanka', 'LK']), new pyjslib_List(['Sudan', 'SD']), new pyjslib_List(['Suriname', 'SR']), new pyjslib_List(['Svalbard And Jan Mayen', 'SJ']), new pyjslib_List(['Swaziland', 'SZ']), new pyjslib_List(['Sweden', 'SE']), new pyjslib_List(['Switzerland', 'CH']), new pyjslib_List(['Syrian Arab Republic', 'SY']), new pyjslib_List(['Taiwan, Province Of China', 'TW']), new pyjslib_List(['Tajikistan', 'TJ']), new pyjslib_List(['Tanzania, United Republic Of', 'TZ']), new pyjslib_List(['Thailand', 'TH']), new pyjslib_List(['Timor-leste', 'TL']), new pyjslib_List(['Togo', 'TG']), new pyjslib_List(['Tokelau', 'TK']), new pyjslib_List(['Tonga', 'TO']), new pyjslib_List(['Trinidad And Tobago', 'TT']), new pyjslib_List(['Tunisia', 'TN']), new pyjslib_List(['Turkey', 'TR']), new pyjslib_List(['Turkmenistan', 'TM']), new pyjslib_List(['Turks And Caicos Islands', 'TC']), new pyjslib_List(['Tuvalu', 'TV']), new pyjslib_List(['Uganda', 'UG']), new pyjslib_List(['Ukraine', 'UA']), new pyjslib_List(['United Arab Emirates', 'AE']), new pyjslib_List(['United Kingdom', 'GB']), new pyjslib_List(['United States', 'US']), new pyjslib_List(['United States Minor Outlying Islands', 'UM']), new pyjslib_List(['Uruguay', 'UY']), new pyjslib_List(['Uzbekistan', 'UZ']), new pyjslib_List(['Vanuatu', 'VU']), new pyjslib_List(['Venezuela', 'VE']), new pyjslib_List(['Viet Nam', 'VN']), new pyjslib_List(['Virgin Islands, British', 'VG']), new pyjslib_List(['Virgin Islands, U.s.', 'VI']), new pyjslib_List(['Wallis And Futuna', 'WF']), new pyjslib_List(['Western Sahara', 'EH']), new pyjslib_List(['Yemen', 'YE']), new pyjslib_List(['Zambia', 'ZM']), new pyjslib_List(['Zimbabwe', 'ZW'])]);
    __CountryListBox_CountryListBox.prototype.__init__ = function() {
    __ui_ListBox.prototype.__class__.__init__(this);
    this.addCountries();
    };
    __CountryListBox_CountryListBox.prototype.__class__.__init__ = function() {
        return __CountryListBox_CountryListBox.prototype.__init__.call.apply(__CountryListBox_CountryListBox.prototype.__init__, arguments);
    };
    __CountryListBox_CountryListBox.prototype.__class__.__init__.unbound_method = true;
    __CountryListBox_CountryListBox.prototype.__init__.instance_method = true;
    __CountryListBox_CountryListBox.prototype.addCountries = function() {

        var __countryItem = this.country_list.__iter__();
        try {
            while (true) {
                var countryItem = __countryItem.next();
                
        
    this.addItem(countryItem.__getitem__(0), countryItem.__getitem__(1));

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __CountryListBox_CountryListBox.prototype.__class__.addCountries = function() {
        return __CountryListBox_CountryListBox.prototype.addCountries.call.apply(__CountryListBox_CountryListBox.prototype.addCountries, arguments);
    };
    __CountryListBox_CountryListBox.prototype.__class__.addCountries.unbound_method = true;
    __CountryListBox_CountryListBox.prototype.addCountries.instance_method = true;
}
__CountryListBox_CountryListBox_initialize();
function __AutoComplete_AutoCompleteTextBox() {
}
function AutoComplete_AutoCompleteTextBox() {
    var instance = new __AutoComplete_AutoCompleteTextBox();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __AutoComplete_AutoCompleteTextBox_initialize() {
    if(__AutoComplete_AutoCompleteTextBox.__was_initialized__) return;
    __AutoComplete_AutoCompleteTextBox.__was_initialized__ = true;
    if(!__ui_TextBox.__was_initialized__)
        __ui_TextBox_initialize();
    pyjs_extend(__AutoComplete_AutoCompleteTextBox, __ui_TextBox);
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.__new__ = AutoComplete_AutoCompleteTextBox;
    __AutoComplete_AutoCompleteTextBox.prototype.__init__ = function() {
    this.choicesPopup = ui_PopupPanel(true);
    this.choices = ui_ListBox();
    this.items = AutoComplete_SimpleAutoCompletionItems();
    this.popupAdded = false;
    this.visible = false;
    __ui_TextBox.prototype.__class__.__init__(this);
    this.addKeyboardListener(this);
    this.choices.addChangeListener(this);
    this.setStyleName('AutoCompleteTextBox');
    this.choicesPopup.add(this.choices);
    this.choicesPopup.addStyleName('AutoCompleteChoices');
    this.choices.setStyleName('list');
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.__init__ = function() {
        return __AutoComplete_AutoCompleteTextBox.prototype.__init__.call.apply(__AutoComplete_AutoCompleteTextBox.prototype.__init__, arguments);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.__init__.unbound_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.__init__.instance_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.setCompletionItems = function(items) {
    if (!(items.getCompletionItems)) {
    var items = AutoComplete_SimpleAutoCompletionItems(items);
    }
    this.items = items;
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.setCompletionItems = function() {
        return __AutoComplete_AutoCompleteTextBox.prototype.setCompletionItems.call.apply(__AutoComplete_AutoCompleteTextBox.prototype.setCompletionItems, arguments);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.setCompletionItems.unbound_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.setCompletionItems.instance_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.getCompletionItems = function() {
    return this.items;
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.getCompletionItems = function() {
        return __AutoComplete_AutoCompleteTextBox.prototype.getCompletionItems.call.apply(__AutoComplete_AutoCompleteTextBox.prototype.getCompletionItems, arguments);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.getCompletionItems.unbound_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.getCompletionItems.instance_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onKeyDown = function(arg0, arg1, arg2) {
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onKeyDown = function() {
        return __AutoComplete_AutoCompleteTextBox.prototype.onKeyDown.call.apply(__AutoComplete_AutoCompleteTextBox.prototype.onKeyDown, arguments);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onKeyDown.unbound_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onKeyDown.instance_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onKeyPress = function(arg0, arg1, arg2) {
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onKeyPress = function() {
        return __AutoComplete_AutoCompleteTextBox.prototype.onKeyPress.call.apply(__AutoComplete_AutoCompleteTextBox.prototype.onKeyPress, arguments);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onKeyPress.unbound_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onKeyPress.instance_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onKeyUp = function(arg0, arg1, arg2) {
    if ((arg1 == __ui_KeyboardListener.prototype.__class__.KEY_DOWN)) {
    var selectedIndex = this.choices.getSelectedIndex();
    selectedIndex += 1;
    if ((selectedIndex > this.choices.getItemCount())) {
    var selectedIndex = 0;
    }
    this.choices.setSelectedIndex(selectedIndex);
    return;
    }
    if ((arg1 == __ui_KeyboardListener.prototype.__class__.KEY_UP)) {
    var selectedIndex = this.choices.getSelectedIndex();
    selectedIndex -= 1;
    if ((selectedIndex < 0)) {
    var selectedIndex = this.choices.getItemCount();
    }
    this.choices.setSelectedIndex(selectedIndex);
    return;
    }
    if ((arg1 == __ui_KeyboardListener.prototype.__class__.KEY_ENTER)) {
    if (this.visible) {
    this.complete();
    }
    return;
    }
    if ((arg1 == __ui_KeyboardListener.prototype.__class__.KEY_ESCAPE)) {
    this.choices.clear();
    this.choicesPopup.hide();
    this.visible = false;
    return;
    }
    var text = this.getText();
    var matches = new pyjslib_List([]);
    if ((pyjslib_len(text) > 0)) {
    var matches = this.items.getCompletionItems(text);
    }
    if ((pyjslib_len(matches) > 0)) {
    this.choices.clear();

        var __i = pyjslib_range(pyjslib_len(matches)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.choices.addItem(matches.__getitem__(i));

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    if (((pyjslib_len(matches) == 1)) && ((matches.__getitem__(0) == text))) {
    this.choicesPopup.hide();
    }
    else {
    this.choices.setSelectedIndex(0);
    this.choices.setVisibleItemCount( ( pyjslib_len(matches) + 1 ) );
    if (!(this.popupAdded)) {
    ui_RootPanel().add(this.choicesPopup);
    this.popupAdded = true;
    }
    this.choicesPopup.show();
    this.visible = true;
    this.choicesPopup.setPopupPosition(this.getAbsoluteLeft(),  ( this.getAbsoluteTop() + this.getOffsetHeight() ) );
    this.choices.setWidth( ( this.getOffsetWidth() + 'px' ) );
    }
    }
    else {
    this.visible = false;
    this.choicesPopup.hide();
    }
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onKeyUp = function() {
        return __AutoComplete_AutoCompleteTextBox.prototype.onKeyUp.call.apply(__AutoComplete_AutoCompleteTextBox.prototype.onKeyUp, arguments);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onKeyUp.unbound_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onKeyUp.instance_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onChange = function(arg0) {
    this.complete();
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onChange = function() {
        return __AutoComplete_AutoCompleteTextBox.prototype.onChange.call.apply(__AutoComplete_AutoCompleteTextBox.prototype.onChange, arguments);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onChange.unbound_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onChange.instance_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onClick = function(arg0) {
    this.complete();
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onClick = function() {
        return __AutoComplete_AutoCompleteTextBox.prototype.onClick.call.apply(__AutoComplete_AutoCompleteTextBox.prototype.onClick, arguments);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.onClick.unbound_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.onClick.instance_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.complete = function() {
    if ((this.choices.getItemCount() > 0)) {
    this.setText(this.choices.getItemText(this.choices.getSelectedIndex()));
    }
    this.choices.clear();
    this.choicesPopup.hide();
    this.setFocus(true);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.complete = function() {
        return __AutoComplete_AutoCompleteTextBox.prototype.complete.call.apply(__AutoComplete_AutoCompleteTextBox.prototype.complete, arguments);
    };
    __AutoComplete_AutoCompleteTextBox.prototype.__class__.complete.unbound_method = true;
    __AutoComplete_AutoCompleteTextBox.prototype.complete.instance_method = true;
}
function __AutoComplete_SimpleAutoCompletionItems() {
}
function AutoComplete_SimpleAutoCompletionItems(items) {
    if (typeof items == 'undefined') items=null;
    var instance = new __AutoComplete_SimpleAutoCompletionItems();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


AutoComplete_SimpleAutoCompletionItems.parse_kwargs = function ( __kwargs, items ) {
    if (typeof items == 'undefined')
        items=__kwargs.items;
    var __r = [items];
    return __r;
};
function __AutoComplete_SimpleAutoCompletionItems_initialize() {
    if(__AutoComplete_SimpleAutoCompletionItems.__was_initialized__) return;
    __AutoComplete_SimpleAutoCompletionItems.__was_initialized__ = true;
    pyjs_extend(__AutoComplete_SimpleAutoCompletionItems, __pyjslib_Object);
    __AutoComplete_SimpleAutoCompletionItems.prototype.__class__.__new__ = AutoComplete_SimpleAutoCompletionItems;
    __AutoComplete_SimpleAutoCompletionItems.prototype.__init__ = function(items) {
    if (typeof items == 'undefined') items=null;
    if ((items == null)) {
    var items = new pyjslib_List([]);
    }
    this.completions = items;
    };
__AutoComplete_SimpleAutoCompletionItems.prototype.__init__.parse_kwargs = function ( __kwargs, items ) {
    if (typeof items == 'undefined')
        items=__kwargs.items;
    var __r = [items];
    return __r;
};
    __AutoComplete_SimpleAutoCompletionItems.prototype.__class__.__init__ = function() {
        return __AutoComplete_SimpleAutoCompletionItems.prototype.__init__.call.apply(__AutoComplete_SimpleAutoCompletionItems.prototype.__init__, arguments);
    };
    __AutoComplete_SimpleAutoCompletionItems.prototype.__class__.__init__.unbound_method = true;
    __AutoComplete_SimpleAutoCompletionItems.prototype.__init__.instance_method = true;
    __AutoComplete_SimpleAutoCompletionItems.prototype.__class__.__init__.parse_kwargs = __AutoComplete_SimpleAutoCompletionItems.prototype.__init__.parse_kwargs;
    __AutoComplete_SimpleAutoCompletionItems.prototype.getCompletionItems = function(match) {
    var matches = new pyjslib_List([]);
    var match = match.lower();

        var __i = pyjslib_range(pyjslib_len(this.completions)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    var lower = this.completions.__getitem__(i).lower();
    if (lower.startswith(match)) {
    matches.append(this.completions.__getitem__(i));
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    return matches;
    };
    __AutoComplete_SimpleAutoCompletionItems.prototype.__class__.getCompletionItems = function() {
        return __AutoComplete_SimpleAutoCompletionItems.prototype.getCompletionItems.call.apply(__AutoComplete_SimpleAutoCompletionItems.prototype.getCompletionItems, arguments);
    };
    __AutoComplete_SimpleAutoCompletionItems.prototype.__class__.getCompletionItems.unbound_method = true;
    __AutoComplete_SimpleAutoCompletionItems.prototype.getCompletionItems.instance_method = true;
}
__AutoComplete_SimpleAutoCompletionItems_initialize();
__AutoComplete_AutoCompleteTextBox_initialize();

//
// BEGIN sprintf.js
//

// args is a pyjslib_List
// str is a String
function sprintf2(str, args)
{
   if(args && args.__class__ != "pyjslib_List")
      args = new pyjslib_List([args]);
   if (!args || pyjslib_len(args) < 1 || !RegExp)
   {
      return;
   }
   var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
   var a = b = [], numSubstitutions = 0, numMatches = 0;
   while (a = re.exec(str))
   {
      var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
      var pPrecision = a[5], pType = a[6], rightPart = a[7];
      
      //alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision);

      numMatches++;
      if (pType == '%')
      {
         subst = '%';
      }
      else
      {
         if (numSubstitutions >= args.length)
         {
            alert('Error! Not enough function args (' + (args.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).');
         }
         var param = args.__getitem__(numSubstitutions);
         var pad = '';
                if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1);
           else if (pPad) pad = pPad;
         var justifyRight = true;
                if (pJustify && pJustify === "-") justifyRight = false;
         var minLength = -1;
                if (pMinLength) minLength = parseInt(pMinLength);
         var precision = -1;
                if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1));
         var subst = param;
                if (pType == 'b') subst = parseInt(param).toString(2);
           else if (pType == 'c') subst = String.fromCharCode(parseInt(param));
           else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0;
           else if (pType == 'u') subst = Math.abs(param);
           else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param);
           else if (pType == 'o') subst = parseInt(param).toString(8);
           else if (pType == 's') subst = param;
           else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase();
           else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase();
         numSubstitutions++;
      }
      str = leftpart + subst + rightPart;
   }
   return str;
}

/**
*
*  Javascript sprintf
*  http://www.webtoolkit.info/
*
*
**/

// str is a String
// args is a pyjslib_List or pyjslib_Tuple
sprintfWrapper = {

	init : function (str, args) {

        if (args === undefined)
        {
            return null;
        }
        constructor = null;
        if (!pyjslib_is_basetype(args))
            constructor = pyjslib_get_pyjs_classtype(args);

        if(constructor != "pyjslib_List" && constructor != "pyjslib_Tuple")
        {
            args = new pyjslib_List([args]);
        }

       if (pyjslib_len(args) < 1 || !RegExp)
       {
          return null;
       }

		var exp = new RegExp(/(%([%]|(\-)?(\+|\x20)?(0)?(\d+)?(\.(\d)?)?([bcdfosxX])))/g);
		var matches = new Array();
		var strings = new Array();
		var convCount = 0;
		var stringPosStart = 0;
		var stringPosEnd = 0;
		var matchPosEnd = 0;
		var newString = '';
		var match = null;

		while (match = exp.exec(str)) {
			if (match[9]) { convCount += 1; }

			stringPosStart = matchPosEnd;
			stringPosEnd = exp.lastIndex - match[0].length;
			strings[strings.length] = str.substring(stringPosStart, stringPosEnd);
         var param = args.__getitem__(convCount-1);

			matchPosEnd = exp.lastIndex;
			matches[matches.length] = {
				match: match[0],
				left: match[3] ? true : false,
				sign: match[4] || '',
				pad: match[5] || ' ',
				min: match[6] || 0,
				precision: match[8],
				code: match[9] || '%',
				negative: parseInt(param) < 0 ? true : false,
				argument: String(param)
			};
		}
		strings[strings.length] = str.substring(matchPosEnd);

		if (matches.length == 0) { return str; }
		if ((args.length - 1) < convCount) { return null; }

		var code = null;
		var match = null;
		var i = null;

		for (i=0; i<matches.length; i++) {

			if (matches[i].code == '%') { substitution = '%' }
			else if (matches[i].code == 'b') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(2));
				substitution = sprintfWrapper.convert(matches[i], true);
			}
			else if (matches[i].code == 'c') {
				matches[i].argument = String(String.fromCharCode(parseInt(Math.abs(parseInt(matches[i].argument)))));
				substitution = sprintfWrapper.convert(matches[i], true);
			}
			else if (matches[i].code == 'd') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 'f') {
				matches[i].argument = String(Math.abs(parseFloat(matches[i].argument)).toFixed(matches[i].precision ? matches[i].precision : 6));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 'o') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(8));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 's') {
				matches[i].argument = String(matches[i].argument)
				matches[i].argument = matches[i].argument.substring(0, matches[i].precision ? matches[i].precision : matches[i].argument.length)
				substitution = sprintfWrapper.convert(matches[i], true);
			}
			else if (matches[i].code == 'x') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 'X') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16));
				substitution = sprintfWrapper.convert(matches[i]).toUpperCase();
			}
			else {
				substitution = matches[i].match;
			}

			newString += strings[i];
			newString += substitution;

		}
		newString += strings[i];

		return newString;

	},

	convert : function(match, nosign){
		if (nosign) {
			match.sign = '';
		} else {
			match.sign = match.negative ? '-' : match.sign;
		}
		var l = match.min - match.argument.length + 1 - match.sign.length;
		var pad = new Array(l < 0 ? 0 : l).join(match.pad);
		if (!match.left) {
			if (match.pad == "0" || nosign) {
				return match.sign + pad + match.argument;
			} else {
				return pad + match.sign + match.argument;
			}
		} else {
			if (match.pad == "0" || nosign) {
				return match.sign + match.argument + pad.replace(/0/g, ' ');
			} else {
				return match.sign + match.argument + pad;
			}
		}
	}
}

sprintf = sprintfWrapper.init;

//
// END sprintf.js
//
function __dbwidgets_CrudPanel() {
}
function dbwidgets_CrudPanel(tableName, fields, listUrl, editUrl, insertUrl, deleteUrl, labelAjax) {
    if (typeof tableName == 'undefined') tableName='';
    if (typeof fields == 'undefined') fields=null;
    if (typeof listUrl == 'undefined') listUrl='list';
    if (typeof editUrl == 'undefined') editUrl='edit';
    if (typeof insertUrl == 'undefined') insertUrl='insert';
    if (typeof deleteUrl == 'undefined') deleteUrl='delete';
    if (typeof labelAjax == 'undefined') labelAjax=null;
    var instance = new __dbwidgets_CrudPanel();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


dbwidgets_CrudPanel.parse_kwargs = function ( __kwargs, tableName, fields, listUrl, editUrl, insertUrl, deleteUrl, labelAjax ) {
    if (typeof tableName == 'undefined')
        tableName=__kwargs.tableName;
    if (typeof fields == 'undefined')
        fields=__kwargs.fields;
    if (typeof listUrl == 'undefined')
        listUrl=__kwargs.listUrl;
    if (typeof editUrl == 'undefined')
        editUrl=__kwargs.editUrl;
    if (typeof insertUrl == 'undefined')
        insertUrl=__kwargs.insertUrl;
    if (typeof deleteUrl == 'undefined')
        deleteUrl=__kwargs.deleteUrl;
    if (typeof labelAjax == 'undefined')
        labelAjax=__kwargs.labelAjax;
    var __r = [tableName, fields, listUrl, editUrl, insertUrl, deleteUrl, labelAjax];
    return __r;
};
function __dbwidgets_CrudPanel_initialize() {
    if(__dbwidgets_CrudPanel.__was_initialized__) return;
    __dbwidgets_CrudPanel.__was_initialized__ = true;
    if(!__ui_SimplePanel.__was_initialized__)
        __ui_SimplePanel_initialize();
    pyjs_extend(__dbwidgets_CrudPanel, __ui_SimplePanel);
    __dbwidgets_CrudPanel.prototype.__class__.__new__ = dbwidgets_CrudPanel;
    __dbwidgets_CrudPanel.prototype.__init__ = function(tableName, fields, listUrl, editUrl, insertUrl, deleteUrl, labelAjax) {
    if (typeof tableName == 'undefined') tableName='';
    if (typeof fields == 'undefined') fields=null;
    if (typeof listUrl == 'undefined') listUrl='list';
    if (typeof editUrl == 'undefined') editUrl='edit';
    if (typeof insertUrl == 'undefined') insertUrl='insert';
    if (typeof deleteUrl == 'undefined') deleteUrl='delete';
    if (typeof labelAjax == 'undefined') labelAjax=null;
    __ui_SimplePanel.prototype.__class__.__init__(this);
    if ((tableName == '')) {
    this.tableName = 'Afiliados';
    }
    else {
    this.tableName = tableName;
    }
    if ((fields == null)) {
    this.fields = new pyjslib_List([pyjs_kwargs_function_call(Record, [{colName:'id', colRepr:'Id', isId:true, isVisible:false}]), pyjs_kwargs_function_call(Record, [{colName:'nombre', colRepr:'Nombre'}]), pyjs_kwargs_function_call(Record, [{colName:'fechanac', colRepr:'Nacimiento'}])]);
    }
    else {
    this.fields = fields;
    }
    this.listUrl = listUrl;
    this.editUrl = editUrl;
    this.insertUrl = insertUrl;
    this.deleteUrl = deleteUrl;
    this.lblAjax = labelAjax;
    this.listFields = null;
    this.currentRecord = null;
    this.recordList = null;
    this.totalAfis = 0;
    this.totalPages = 0;
    this.currentPage = null;
    this.localSortCol = 0;
    this.localSortOrder = 1;
    var contents = ui_VerticalPanel();
    contents.setSpacing(4);
    contents.setHorizontalAlignment(__ui_HasAlignment.prototype.__class__.ALIGN_CENTER);
    this.lista = ui_SimplePanel();
    contents.add(this.lista);
    var pagebar = ui_HorizontalPanel();
    pagebar.setVerticalAlignment(__ui_HasAlignment.prototype.__class__.ALIGN_MIDDLE);
    pagebar.setSpacing(4);
    pagebar.add(ui_Button('&lt;&lt;', pyjslib_getattr(this, 'onGoFirst')));
    this.btnPrevious = ui_Button('&lt;', pyjslib_getattr(this, 'onGoPrevious'));
    pagebar.add(this.btnPrevious);
    pagebar.add(ui_Label('Pag.'));
    this.txtInicio = ui_TextBox();
    this.txtInicio.setVisibleLength(4);
    this.txtInicio.setTextAlignment(__ui_HasAlignment.prototype.__class__.ALIGN_RIGHT);
    this.txtInicio.setText('0');
    this.txtInicio.addKeyboardListener(this);
    pagebar.add(this.txtInicio);
    pagebar.add(ui_Label('/'));
    this.lblTotalPages = ui_Label('0');
    pagebar.add(this.lblTotalPages);
    this.btnNext = ui_Button('&gt;', pyjslib_getattr(this, 'onGoNext'));
    pagebar.add(this.btnNext);
    pagebar.add(ui_Button('&gt;&gt;', pyjslib_getattr(this, 'onGoLast')));
    pagebar.add(ui_Label('  Regs. x Pag:'));
    this.txtCantidad = ui_TextBox();
    this.txtCantidad.setVisibleLength(2);
    this.txtCantidad.setMaxLength(2);
    this.txtCantidad.setTextAlignment(__ui_HasAlignment.prototype.__class__.ALIGN_RIGHT);
    this.txtCantidad.setText('10');
    this.txtCantidad.addKeyboardListener(this);
    pagebar.add(this.txtCantidad);
    pagebar.add(ui_Label(' Ordenar por:'));
    this.cboSortBy = ui_ListBox();

        var __i = pyjslib_range(pyjslib_len(this.fields)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    if (this.fields.__getitem__(i).__getitem__('isVisible')) {
    pyjs_kwargs_method_call(this.cboSortBy, 'addItem', [{value:this.fields.__getitem__(i).__getitem__('colName')}, this.fields.__getitem__(i).__getitem__('colRepr')]);
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    this.cboSortBy.setVisibleItemCount(0);
    this.cboSortBy.addChangeListener(pyjslib_getattr(this, 'requestList'));
    pagebar.add(this.cboSortBy);
    this.cboSortOrder = ui_ListBox();
    this.cboSortOrder.setVisibleItemCount(0);
    pyjs_kwargs_method_call(this.cboSortOrder, 'addItem', [{value:'asc'}, 'ASC']);
    pyjs_kwargs_method_call(this.cboSortOrder, 'addItem', [{value:'desc'}, 'DESC']);
    this.cboSortOrder.addChangeListener(pyjslib_getattr(this, 'requestList'));
    pagebar.add(this.cboSortOrder);
    pagebar.setStyleName('bordered');
    contents.add(pagebar);
    var toolbar = ui_HorizontalPanel();
    toolbar.setSpacing(4);
    toolbar.add(ui_Label('Buscar: '));
    this.txtSearch = ui_TextBox();
    this.txtSearch.setVisibleLength(30);
    this.txtSearch.addKeyboardListener(this);
    toolbar.add(this.txtSearch);
    toolbar.add(ui_Button('Actualizar', pyjslib_getattr(this, 'requestList')));
    toolbar.add(ui_Button('Insertar', pyjslib_getattr(this, 'onInsert')));
    this.btnEdit = ui_Button('Editar', pyjslib_getattr(this, 'onEdit'));
    toolbar.add(this.btnEdit);
    this.btnDelete = ui_Button('Eliminar', pyjslib_getattr(this, 'onDelete'));
    toolbar.add(this.btnDelete);
    contents.add(toolbar);
    contents.setStyleName('Contents');
    this.setWidget(contents);
    };
__dbwidgets_CrudPanel.prototype.__init__.parse_kwargs = function ( __kwargs, tableName, fields, listUrl, editUrl, insertUrl, deleteUrl, labelAjax ) {
    if (typeof tableName == 'undefined')
        tableName=__kwargs.tableName;
    if (typeof fields == 'undefined')
        fields=__kwargs.fields;
    if (typeof listUrl == 'undefined')
        listUrl=__kwargs.listUrl;
    if (typeof editUrl == 'undefined')
        editUrl=__kwargs.editUrl;
    if (typeof insertUrl == 'undefined')
        insertUrl=__kwargs.insertUrl;
    if (typeof deleteUrl == 'undefined')
        deleteUrl=__kwargs.deleteUrl;
    if (typeof labelAjax == 'undefined')
        labelAjax=__kwargs.labelAjax;
    var __r = [tableName, fields, listUrl, editUrl, insertUrl, deleteUrl, labelAjax];
    return __r;
};
    __dbwidgets_CrudPanel.prototype.__class__.__init__ = function() {
        return __dbwidgets_CrudPanel.prototype.__init__.call.apply(__dbwidgets_CrudPanel.prototype.__init__, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.__init__.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.__init__.instance_method = true;
    __dbwidgets_CrudPanel.prototype.__class__.__init__.parse_kwargs = __dbwidgets_CrudPanel.prototype.__init__.parse_kwargs;
    __dbwidgets_CrudPanel.prototype.onGoFirst = function() {
    this.currentPage = 1;
    this.txtInicio.setText(pyjslib_str(this.currentPage));
    this.requestList();
    };
    __dbwidgets_CrudPanel.prototype.__class__.onGoFirst = function() {
        return __dbwidgets_CrudPanel.prototype.onGoFirst.call.apply(__dbwidgets_CrudPanel.prototype.onGoFirst, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onGoFirst.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onGoFirst.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onGoPrevious = function() {
    if ((this.currentPage > 1)) {
    this.currentPage -= 1;
    this.txtInicio.setText(pyjslib_str(this.currentPage));
    this.requestList();
    }
    };
    __dbwidgets_CrudPanel.prototype.__class__.onGoPrevious = function() {
        return __dbwidgets_CrudPanel.prototype.onGoPrevious.call.apply(__dbwidgets_CrudPanel.prototype.onGoPrevious, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onGoPrevious.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onGoPrevious.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onGoNext = function() {
    if ((this.currentPage < this.totalPages)) {
    this.currentPage += 1;
    this.txtInicio.setText(pyjslib_str(this.currentPage));
    this.requestList();
    }
    };
    __dbwidgets_CrudPanel.prototype.__class__.onGoNext = function() {
        return __dbwidgets_CrudPanel.prototype.onGoNext.call.apply(__dbwidgets_CrudPanel.prototype.onGoNext, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onGoNext.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onGoNext.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onGoLast = function() {
    this.currentPage = this.totalPages;
    this.txtInicio.setText(pyjslib_str(this.currentPage));
    this.requestList();
    };
    __dbwidgets_CrudPanel.prototype.__class__.onGoLast = function() {
        return __dbwidgets_CrudPanel.prototype.onGoLast.call.apply(__dbwidgets_CrudPanel.prototype.onGoLast, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onGoLast.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onGoLast.instance_method = true;
    __dbwidgets_CrudPanel.prototype._getIdField = function() {

        var __i = pyjslib_range(pyjslib_len(this.fields)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    if (this.fields.__getitem__(i).get('isId')) {
    return i;
    }
    return -1;

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    };
    __dbwidgets_CrudPanel.prototype.__class__._getIdField = function() {
        return __dbwidgets_CrudPanel.prototype._getIdField.call.apply(__dbwidgets_CrudPanel.prototype._getIdField, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__._getIdField.unbound_method = true;
    __dbwidgets_CrudPanel.prototype._getIdField.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onInsert = function() {

        var __i = pyjslib_range(pyjslib_len(this.fields)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.fields.__getitem__(i).__setitem__('colValue', '');

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    var idField = this._getIdField();
    this.fields.__getitem__(idField).__setitem__('colValue', '0');
    var frmEdit = pyjs_kwargs_function_call(dbwidgets_FormEditRecord, [{fields:this.fields, parent:this, labelAjax:this.lblAjax, onReturn:pyjslib_getattr(this, 'requestList'), onAjax:'onActionResult', url:this.insertUrl, tablename:this.tableName}]);
    frmEdit.setPopupPosition( ( this.getAbsoluteLeft() + 200 ) ,  ( this.getAbsoluteTop() + 100 ) );
    frmEdit.show();
    };
    __dbwidgets_CrudPanel.prototype.__class__.onInsert = function() {
        return __dbwidgets_CrudPanel.prototype.onInsert.call.apply(__dbwidgets_CrudPanel.prototype.onInsert, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onInsert.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onInsert.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onEdit = function() {

        var __i = pyjslib_range(pyjslib_len(this.fields)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.fields.__getitem__(i).__setitem__('colValue', pyjslib_str(this.currentRecord.__getitem__(i)));

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    var frmEdit = pyjs_kwargs_function_call(dbwidgets_FormEditRecord, [{fields:this.fields, parent:this, labelAjax:this.lblAjax, onReturn:pyjslib_getattr(this, 'requestList'), onAjax:'onActionResult', url:this.editUrl, tablename:this.tableName}]);
    frmEdit.setPopupPosition( ( this.getAbsoluteLeft() + 150 ) ,  ( this.getAbsoluteTop() + 100 ) );
    frmEdit.show();
    };
    __dbwidgets_CrudPanel.prototype.__class__.onEdit = function() {
        return __dbwidgets_CrudPanel.prototype.onEdit.call.apply(__dbwidgets_CrudPanel.prototype.onEdit, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onEdit.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onEdit.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onDelete = function() {
    var idfield = this._getIdField();
    var question = sprintf('Seguro desea eliminar el registro %s?', this.currentRecord.__getitem__(idfield));
    if (Window_confirm(question)) {
    var url =  (  (  (  ( this.deleteUrl + '/' )  + this.currentRecord.__getitem__(idfield) )  + '?tablename=' )  + this.tableName ) ;
    var thisptr = this;
function callback(text) {
    thisptr.onActionResult(text);
}


    HTTPRequest_HTTPRequest().asyncPost(url, '', JSONLoader(callback, this.lblAjax));
    }
    };
    __dbwidgets_CrudPanel.prototype.__class__.onDelete = function() {
        return __dbwidgets_CrudPanel.prototype.onDelete.call.apply(__dbwidgets_CrudPanel.prototype.onDelete, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onDelete.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onDelete.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onActionResult = function(text) {
    Window_alert(text);
    this.requestList();
    };
    __dbwidgets_CrudPanel.prototype.__class__.onActionResult = function() {
        return __dbwidgets_CrudPanel.prototype.onActionResult.call.apply(__dbwidgets_CrudPanel.prototype.onActionResult, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onActionResult.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onActionResult.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onCloseDialog = function() {
    };
    __dbwidgets_CrudPanel.prototype.__class__.onCloseDialog = function() {
        return __dbwidgets_CrudPanel.prototype.onCloseDialog.call.apply(__dbwidgets_CrudPanel.prototype.onCloseDialog, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onCloseDialog.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onCloseDialog.instance_method = true;
    __dbwidgets_CrudPanel.prototype.localSort = function(col) {
    if ((col == this.localSortCol)) {
    if ((this.localSortOrder == 1)) {
    this.localSortOrder = -1;
    }
    else {
    this.localSortOrder = 1;
    }
    }
    else {
    this.localSortCol = col;
    this.localSortOrder = 1;
    }
    var rev = false;
    if ((this.localSortOrder < 0)) {
    var rev = true;
    }
function keyfunc(it) {
    return it.__getitem__( ( col + 1 ) );
}


    pyjs_kwargs_method_call(this.recordList, 'sort', [{compareFunc:null, keyFunc:keyfunc, reverse:rev}]);
    var newdic = new pyjslib_Dict([]);
    newdic.__setitem__('fields', pyjslib_slice(this.listFields, 1, null));
    var newrows = new pyjslib_List([]);

        var __r = this.recordList.__iter__();
        try {
            while (true) {
                var r = __r.next();
                
        
    newrows.append(pyjslib_slice(r, 1, null));

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    newdic.__setitem__('rows', newrows);
    var grid = jsonrs2grid(newdic);
    grid.setCellPadding(4);
    grid.setCellSpacing(1);
    grid.addTableListener(this);
    this.lista.setWidget(grid);
    };
    __dbwidgets_CrudPanel.prototype.__class__.localSort = function() {
        return __dbwidgets_CrudPanel.prototype.localSort.call.apply(__dbwidgets_CrudPanel.prototype.localSort, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.localSort.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.localSort.instance_method = true;
    __dbwidgets_CrudPanel.prototype.requestList = function() {
    var where = '';
    if (pyjslib_len(this.txtSearch.getText())) {
    where += this.cboSortBy.getValue(this.cboSortBy.getSelectedIndex());
    where += '=';
    where += this.txtSearch.getText();
    }
    var order =  ( this.cboSortBy.getValue(this.cboSortBy.getSelectedIndex()) + ' ' ) ;
    order += this.cboSortOrder.getValue(this.cboSortOrder.getSelectedIndex());
    var params =  (  ( this.txtInicio.getText() + '/' )  + this.txtCantidad.getText() ) ;
    if (where) {
    params +=  ( '/' + where ) ;
    }
    else {
    params += '/1';
    }
    params +=  ( '/' + order ) ;
    var url =  (  ( this.listUrl + '/' )  + params ) ;
    var data = null;
 data = parseInt(Math.random() * 1000000); 
    var data =  ( '?uid=' + pyjslib_str(data) ) ;
    url += data;
    var fielddata =  ( 'fields=' + JSONParser_JSONParser().encode(this.fields) ) ;
    fielddata +=  ( '&tablename=' + this.tableName ) ;
    var thisptr = this;
function callback(text) {
    thisptr.populateList(text);
}


    HTTPRequest_HTTPRequest().asyncPost(url, fielddata, JSONLoader(callback, this.lblAjax));
    };
    __dbwidgets_CrudPanel.prototype.__class__.requestList = function() {
        return __dbwidgets_CrudPanel.prototype.requestList.call.apply(__dbwidgets_CrudPanel.prototype.requestList, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.requestList.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.requestList.instance_method = true;
    __dbwidgets_CrudPanel.prototype.populateList = function(text) {
    var dic = JSONParser_JSONParser().decode(text);
    this.recordList = dic.__getitem__('rows');
    this.totalAfis = pyjslib_int(dic.__getitem__('total'));
    this.currentPage = pyjslib_int(dic.__getitem__('page'));
    this.totalPages = pyjslib_int(dic.__getitem__('numpages'));
    if ((this.currentPage == 1)) {
    this.btnPrevious.setEnabled(false);
    }
    else {
    this.btnPrevious.setEnabled(true);
    }
    if ((this.currentPage == this.totalPages)) {
    this.btnNext.setEnabled(false);
    }
    else {
    this.btnNext.setEnabled(true);
    }
    this.btnEdit.setEnabled(false);
    this.btnDelete.setEnabled(false);
    this.txtInicio.setText(pyjslib_str(this.currentPage));
    this.lblTotalPages.setText(pyjslib_str(this.totalPages));
    var newdic = new pyjslib_Dict([]);
    newdic.__setitem__('fields', this.fields);
    newdic.__setitem__('rows', this.recordList);
    var grid = jsonrs2grid(newdic);
    grid.setCellPadding(4);
    grid.setCellSpacing(1);
    grid.addTableListener(this);
    this.lista.setWidget(grid);
    };
    __dbwidgets_CrudPanel.prototype.__class__.populateList = function() {
        return __dbwidgets_CrudPanel.prototype.populateList.call.apply(__dbwidgets_CrudPanel.prototype.populateList, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.populateList.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.populateList.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onCellClicked = function(grid, row, col) {
    if ((row == 0)) {
    this.localSort(col);
    return;
    }
    this.currentRecord = this.recordList.__getitem__( ( row - 1 ) );
    var formatter = grid.getRowFormatter();

        var __i = pyjslib_range(1, grid.getRowCount()).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    formatter.removeStyleName(i, 'selectedrow');

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    formatter.addStyleName(row, 'selectedrow');
    this.btnEdit.setEnabled(true);
    this.btnDelete.setEnabled(true);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onCellClicked = function() {
        return __dbwidgets_CrudPanel.prototype.onCellClicked.call.apply(__dbwidgets_CrudPanel.prototype.onCellClicked, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onCellClicked.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onCellClicked.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onKeyUp = function(sender, code, modifiers) {
    if (((sender == this.txtInicio)) || ((sender == this.txtCantidad))) {
    if ((code == 13)) {
    this.requestList();
    }
    }
    if ((sender == this.txtSearch)) {
    this.requestList();
    }
    };
    __dbwidgets_CrudPanel.prototype.__class__.onKeyUp = function() {
        return __dbwidgets_CrudPanel.prototype.onKeyUp.call.apply(__dbwidgets_CrudPanel.prototype.onKeyUp, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onKeyUp.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onKeyUp.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onKeyDown = function(sender, code, modifiers) {
    };
    __dbwidgets_CrudPanel.prototype.__class__.onKeyDown = function() {
        return __dbwidgets_CrudPanel.prototype.onKeyDown.call.apply(__dbwidgets_CrudPanel.prototype.onKeyDown, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onKeyDown.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onKeyDown.instance_method = true;
    __dbwidgets_CrudPanel.prototype.onKeyPress = function(sender, code, modifiers) {
    };
    __dbwidgets_CrudPanel.prototype.__class__.onKeyPress = function() {
        return __dbwidgets_CrudPanel.prototype.onKeyPress.call.apply(__dbwidgets_CrudPanel.prototype.onKeyPress, arguments);
    };
    __dbwidgets_CrudPanel.prototype.__class__.onKeyPress.unbound_method = true;
    __dbwidgets_CrudPanel.prototype.onKeyPress.instance_method = true;
}
function __dbwidgets_FormEditRecord() {
}
function dbwidgets_FormEditRecord(title, parent, onReturn, url, fields, tablename, labelAjax, onAjax, autoHide) {
    if (typeof title == 'undefined') title='Registro No ';
    if (typeof parent == 'undefined') parent=null;
    if (typeof onReturn == 'undefined') onReturn=null;
    if (typeof url == 'undefined') url='insert';
    if (typeof fields == 'undefined') fields=null;
    if (typeof tablename == 'undefined') tablename='';
    if (typeof labelAjax == 'undefined') labelAjax=null;
    if (typeof onAjax == 'undefined') onAjax='onActionResult';
    if (typeof autoHide == 'undefined') autoHide=null;
    var instance = new __dbwidgets_FormEditRecord();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


dbwidgets_FormEditRecord.parse_kwargs = function ( __kwargs, title, parent, onReturn, url, fields, tablename, labelAjax, onAjax, autoHide ) {
    if (typeof title == 'undefined')
        title=__kwargs.title;
    if (typeof parent == 'undefined')
        parent=__kwargs.parent;
    if (typeof onReturn == 'undefined')
        onReturn=__kwargs.onReturn;
    if (typeof url == 'undefined')
        url=__kwargs.url;
    if (typeof fields == 'undefined')
        fields=__kwargs.fields;
    if (typeof tablename == 'undefined')
        tablename=__kwargs.tablename;
    if (typeof labelAjax == 'undefined')
        labelAjax=__kwargs.labelAjax;
    if (typeof onAjax == 'undefined')
        onAjax=__kwargs.onAjax;
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    var __r = [title, parent, onReturn, url, fields, tablename, labelAjax, onAjax, autoHide];
    return __r;
};
function __dbwidgets_FormEditRecord_initialize() {
    if(__dbwidgets_FormEditRecord.__was_initialized__) return;
    __dbwidgets_FormEditRecord.__was_initialized__ = true;
    if(!__ui_DialogBox.__was_initialized__)
        __ui_DialogBox_initialize();
    pyjs_extend(__dbwidgets_FormEditRecord, __ui_DialogBox);
    __dbwidgets_FormEditRecord.prototype.__class__.__new__ = dbwidgets_FormEditRecord;
    __dbwidgets_FormEditRecord.prototype.__init__ = function(title, parent, onReturn, url, fields, tablename, labelAjax, onAjax, autoHide) {
    if (typeof title == 'undefined') title='Registro No ';
    if (typeof parent == 'undefined') parent=null;
    if (typeof onReturn == 'undefined') onReturn=null;
    if (typeof url == 'undefined') url='insert';
    if (typeof fields == 'undefined') fields=null;
    if (typeof tablename == 'undefined') tablename='';
    if (typeof labelAjax == 'undefined') labelAjax=null;
    if (typeof onAjax == 'undefined') onAjax='onActionResult';
    if (typeof autoHide == 'undefined') autoHide=null;
    __ui_DialogBox.prototype.__class__.__init__(this, autoHide);
    this.resp = false;
    this.fields = fields;
    if ((tablename == '')) {
    var tablename = 'Afiliados';
    }
    this.tablename = tablename;
    this.parent = parent;
    this.onReturn = onReturn;
    this.lblAjax = labelAjax;
    this.onAjax = onAjax;
    this.url = url;
    this.id = 0;

        var __f = this.fields.__iter__();
        try {
            while (true) {
                var f = __f.next();
                
        
    if (f.get('isId')) {
    this.id = pyjslib_int(f.__getitem__('colValue'));
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    this.mode = 'Insert';
    if ((this.id != 0)) {
    this.mode = 'Update';
    }
    this.setHTML( (  (  ( title + pyjslib_str(this.id) )  + ' - ' )  + this.mode ) );
    var contents = ui_VerticalPanel();
    contents.setSpacing(4);
    var grid = ui_Grid(pyjslib_len(this.fields), 2);
    var formatter = grid.getRowFormatter();
    this.boxes = new pyjslib_List([]);

        var __i = pyjslib_range(pyjslib_len(this.fields)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    grid.setWidget(i, 0, ui_Label(this.fields.__getitem__(i).__getitem__('colRepr')));
    var tb = ui_TextBox();
    tb.setVisibleLength(50);
    tb.setMaxLength(50);
    if (this.fields.__getitem__(i).get('isId')) {
    formatter.setVisible(i, false);
    }
    tb.setText(this.fields.__getitem__(i).__getitem__('colValue'));
    grid.setWidget(i, 1, tb);
    this.boxes.append(tb);

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    contents.add(grid);
    var id1 = __ui_HTMLPanel.prototype.__class__.createUniqueId();
    var id2 = __ui_HTMLPanel.prototype.__class__.createUniqueId();
    var hp = ui_HTMLPanel( (  (  (  ( '<div style=\'text-align: right;\'><span id=' + id2 )  + '><span id=' )  + id1 )  + '></div>' ) );
    hp.setWidth('500px');
    var btnOK = ui_Button('  OK  ', pyjslib_getattr(this, 'onOK'));
    var btnCancel = ui_Button('Cancel', pyjslib_getattr(this, 'onCancel'));
    btnOK.setStyleName('toolbarbutton');
    btnCancel.setStyleName('toolbarbutton');
    hp.add(btnOK, id1);
    hp.add(btnCancel, id2);
    contents.add(hp);
    this.setWidget(contents);
    };
__dbwidgets_FormEditRecord.prototype.__init__.parse_kwargs = function ( __kwargs, title, parent, onReturn, url, fields, tablename, labelAjax, onAjax, autoHide ) {
    if (typeof title == 'undefined')
        title=__kwargs.title;
    if (typeof parent == 'undefined')
        parent=__kwargs.parent;
    if (typeof onReturn == 'undefined')
        onReturn=__kwargs.onReturn;
    if (typeof url == 'undefined')
        url=__kwargs.url;
    if (typeof fields == 'undefined')
        fields=__kwargs.fields;
    if (typeof tablename == 'undefined')
        tablename=__kwargs.tablename;
    if (typeof labelAjax == 'undefined')
        labelAjax=__kwargs.labelAjax;
    if (typeof onAjax == 'undefined')
        onAjax=__kwargs.onAjax;
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    var __r = [title, parent, onReturn, url, fields, tablename, labelAjax, onAjax, autoHide];
    return __r;
};
    __dbwidgets_FormEditRecord.prototype.__class__.__init__ = function() {
        return __dbwidgets_FormEditRecord.prototype.__init__.call.apply(__dbwidgets_FormEditRecord.prototype.__init__, arguments);
    };
    __dbwidgets_FormEditRecord.prototype.__class__.__init__.unbound_method = true;
    __dbwidgets_FormEditRecord.prototype.__init__.instance_method = true;
    __dbwidgets_FormEditRecord.prototype.__class__.__init__.parse_kwargs = __dbwidgets_FormEditRecord.prototype.__init__.parse_kwargs;
    __dbwidgets_FormEditRecord.prototype.onActionResult = function(text) {
    Window_alert(text);
    };
    __dbwidgets_FormEditRecord.prototype.__class__.onActionResult = function() {
        return __dbwidgets_FormEditRecord.prototype.onActionResult.call.apply(__dbwidgets_FormEditRecord.prototype.onActionResult, arguments);
    };
    __dbwidgets_FormEditRecord.prototype.__class__.onActionResult.unbound_method = true;
    __dbwidgets_FormEditRecord.prototype.onActionResult.instance_method = true;
    __dbwidgets_FormEditRecord.prototype.onOK = function() {
    this.resp = true;
    var params = '';

        var __i = pyjslib_range(pyjslib_len(this.boxes)).__iter__();
        try {
            while (true) {
                var i = __i.next();
                
        
    this.fields.__getitem__(i).__setitem__('colValue', this.boxes.__getitem__(i).getText());

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    var url = this.url;
    var params =  ( 'fields=' + JSONParser_JSONParser().encode(this.fields) ) ;
    params +=  ( '&tablename=' + this.tablename ) ;
    var thisptr = this;
function callback(text) {
    thisptr.onActionResult(text);
}


    HTTPRequest_HTTPRequest().asyncPost(url, params, JSONLoader(callback, this.lblAjax));
    if (this.onReturn) {
    this.onReturn();
    }
    this.hide();
    };
    __dbwidgets_FormEditRecord.prototype.__class__.onOK = function() {
        return __dbwidgets_FormEditRecord.prototype.onOK.call.apply(__dbwidgets_FormEditRecord.prototype.onOK, arguments);
    };
    __dbwidgets_FormEditRecord.prototype.__class__.onOK.unbound_method = true;
    __dbwidgets_FormEditRecord.prototype.onOK.instance_method = true;
    __dbwidgets_FormEditRecord.prototype.onCancel = function() {
    this.hide();
    };
    __dbwidgets_FormEditRecord.prototype.__class__.onCancel = function() {
        return __dbwidgets_FormEditRecord.prototype.onCancel.call.apply(__dbwidgets_FormEditRecord.prototype.onCancel, arguments);
    };
    __dbwidgets_FormEditRecord.prototype.__class__.onCancel.unbound_method = true;
    __dbwidgets_FormEditRecord.prototype.onCancel.instance_method = true;
}
__dbwidgets_CrudPanel_initialize();
__dbwidgets_FormEditRecord_initialize();
function makerecord(colName, colRepr, colValue, isId, isVisible) {
    if (typeof colRepr == 'undefined') colRepr=null;
    if (typeof colValue == 'undefined') colValue='';
    if (typeof isId == 'undefined') isId=false;
    if (typeof isVisible == 'undefined') isVisible=true;
    var record = new pyjslib_Dict([]);
    record.__setitem__('colName', colName);
    if (!(colRepr)) {
    var colRepr = colName;
    }
    record.__setitem__('colRepr', colRepr);
    record.__setitem__('colValue', colValue);
    record.__setitem__('isId', isId);
    record.__setitem__('isVisible', isVisible);
    return record;
}


makerecord.parse_kwargs = function ( __kwargs, colName, colRepr, colValue, isId, isVisible ) {
    if (typeof colRepr == 'undefined')
        colRepr=__kwargs.colRepr;
    if (typeof colValue == 'undefined')
        colValue=__kwargs.colValue;
    if (typeof isId == 'undefined')
        isId=__kwargs.isId;
    if (typeof isVisible == 'undefined')
        isVisible=__kwargs.isVisible;
    var __r = [colName, colRepr, colValue, isId, isVisible];
    return __r;
};
function jsonrs2grid(dic) {
    var vert =  ( pyjslib_len(dic.__getitem__('rows')) + 1 ) ;
    var horz = 0;
    var flds = dic.__getitem__('fields');
    var rws = dic.__getitem__('rows');

        var __f = flds.__iter__();
        try {
            while (true) {
                var f = __f.next();
                
        
    if (f.__getitem__('isVisible')) {
    horz += 1;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    var grid = ui_Grid(vert, horz);
    var formatter = grid.getRowFormatter();
    var horzcounter = 0;

        var __f = flds.__iter__();
        try {
            while (true) {
                var f = __f.next();
                
        
    if (f.__getitem__('isVisible')) {
    grid.setHTML(0, horzcounter,  (  ( '<b>' + f.__getitem__('colRepr') )  + '</b>' ) );
    horzcounter += 1;
    }

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    formatter.addStyleName(0, 'tableheader');

        var __y = pyjslib_range(1, vert).__iter__();
        try {
            while (true) {
                var y = __y.next();
                
        
    var horzcounter = 0;
    var fieldcounter = 0;

        var __f = flds.__iter__();
        try {
            while (true) {
                var f = __f.next();
                
        
    if (f.__getitem__('isVisible')) {
    grid.setText(y, horzcounter, pyjslib_str(rws.__getitem__( ( y - 1 ) ).__getitem__(fieldcounter)));
    horzcounter += 1;
    }
    fieldcounter += 1;

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    if (!(y % 2)) {
    formatter.addStyleName(y, 'evenrow');
    }
    formatter.addStyleName(y, 'tablebody');

            }
        } catch (e) {
            if (e != StopIteration) {
                throw e;
            }
        }
        
    grid.setStyleName('bordered zebra');
    return grid;
}


function __AjaxLoader() {
}
function AjaxLoader(lblAjax) {
    if (typeof lblAjax == 'undefined') lblAjax=null;
    var instance = new __AjaxLoader();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


AjaxLoader.parse_kwargs = function ( __kwargs, lblAjax ) {
    if (typeof lblAjax == 'undefined')
        lblAjax=__kwargs.lblAjax;
    var __r = [lblAjax];
    return __r;
};
function __AjaxLoader_initialize() {
    if(__AjaxLoader.__was_initialized__) return;
    __AjaxLoader.__was_initialized__ = true;
    pyjs_extend(__AjaxLoader, __pyjslib_Object);
    __AjaxLoader.prototype.__class__.__new__ = AjaxLoader;
    __AjaxLoader.prototype.__init__ = function(lblAjax) {
    if (typeof lblAjax == 'undefined') lblAjax=null;
    this.lblAjax = lblAjax;
    if (this.lblAjax) {
    this.lblAjax.setVisible(true);
    }
    };
__AjaxLoader.prototype.__init__.parse_kwargs = function ( __kwargs, lblAjax ) {
    if (typeof lblAjax == 'undefined')
        lblAjax=__kwargs.lblAjax;
    var __r = [lblAjax];
    return __r;
};
    __AjaxLoader.prototype.__class__.__init__ = function() {
        return __AjaxLoader.prototype.__init__.call.apply(__AjaxLoader.prototype.__init__, arguments);
    };
    __AjaxLoader.prototype.__class__.__init__.unbound_method = true;
    __AjaxLoader.prototype.__init__.instance_method = true;
    __AjaxLoader.prototype.__class__.__init__.parse_kwargs = __AjaxLoader.prototype.__init__.parse_kwargs;
    __AjaxLoader.prototype.onCompletion = function(text) {
    if (this.lblAjax) {
    this.lblAjax.setVisible(false);
    }
    };
    __AjaxLoader.prototype.__class__.onCompletion = function() {
        return __AjaxLoader.prototype.onCompletion.call.apply(__AjaxLoader.prototype.onCompletion, arguments);
    };
    __AjaxLoader.prototype.__class__.onCompletion.unbound_method = true;
    __AjaxLoader.prototype.onCompletion.instance_method = true;
    __AjaxLoader.prototype.onError = function(text, code) {
    if (this.lblAjax) {
    this.lblAjax.setVisible(false);
    }
    Window_alert( (  (  ( 'Error: ' + text )  + '\nCodigo: ' )  + code ) );
    };
    __AjaxLoader.prototype.__class__.onError = function() {
        return __AjaxLoader.prototype.onError.call.apply(__AjaxLoader.prototype.onError, arguments);
    };
    __AjaxLoader.prototype.__class__.onError.unbound_method = true;
    __AjaxLoader.prototype.onError.instance_method = true;
    __AjaxLoader.prototype.onTimeout = function(text) {
    if (this.lblAjax) {
    this.lblAjax.setVisible(false);
    }
    Window_alert( ( 'Timeout: ' + text ) );
    };
    __AjaxLoader.prototype.__class__.onTimeout = function() {
        return __AjaxLoader.prototype.onTimeout.call.apply(__AjaxLoader.prototype.onTimeout, arguments);
    };
    __AjaxLoader.prototype.__class__.onTimeout.unbound_method = true;
    __AjaxLoader.prototype.onTimeout.instance_method = true;
}
function __HTMLLoader() {
}
function HTMLLoader(widget, lblAjax) {
    if (typeof lblAjax == 'undefined') lblAjax=null;
    var instance = new __HTMLLoader();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


HTMLLoader.parse_kwargs = function ( __kwargs, widget, lblAjax ) {
    if (typeof lblAjax == 'undefined')
        lblAjax=__kwargs.lblAjax;
    var __r = [widget, lblAjax];
    return __r;
};
function __HTMLLoader_initialize() {
    if(__HTMLLoader.__was_initialized__) return;
    __HTMLLoader.__was_initialized__ = true;
    if(!__AjaxLoader.__was_initialized__)
        __AjaxLoader_initialize();
    pyjs_extend(__HTMLLoader, __AjaxLoader);
    __HTMLLoader.prototype.__class__.__new__ = HTMLLoader;
    __HTMLLoader.prototype.__init__ = function(widget, lblAjax) {
    if (typeof lblAjax == 'undefined') lblAjax=null;
    this.widget = widget;
    __AjaxLoader.prototype.__class__.__init__(this, lblAjax);
    };
__HTMLLoader.prototype.__init__.parse_kwargs = function ( __kwargs, widget, lblAjax ) {
    if (typeof lblAjax == 'undefined')
        lblAjax=__kwargs.lblAjax;
    var __r = [widget, lblAjax];
    return __r;
};
    __HTMLLoader.prototype.__class__.__init__ = function() {
        return __HTMLLoader.prototype.__init__.call.apply(__HTMLLoader.prototype.__init__, arguments);
    };
    __HTMLLoader.prototype.__class__.__init__.unbound_method = true;
    __HTMLLoader.prototype.__init__.instance_method = true;
    __HTMLLoader.prototype.__class__.__init__.parse_kwargs = __HTMLLoader.prototype.__init__.parse_kwargs;
    __HTMLLoader.prototype.onCompletion = function(text) {
    __AjaxLoader.prototype.__class__.onCompletion(this, text);
    this.widget.setText(text);
    };
    __HTMLLoader.prototype.__class__.onCompletion = function() {
        return __HTMLLoader.prototype.onCompletion.call.apply(__HTMLLoader.prototype.onCompletion, arguments);
    };
    __HTMLLoader.prototype.__class__.onCompletion.unbound_method = true;
    __HTMLLoader.prototype.onCompletion.instance_method = true;
}
function __JSONLoader() {
}
function JSONLoader(func, lblAjax) {
    if (typeof lblAjax == 'undefined') lblAjax=null;
    var instance = new __JSONLoader();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


JSONLoader.parse_kwargs = function ( __kwargs, func, lblAjax ) {
    if (typeof lblAjax == 'undefined')
        lblAjax=__kwargs.lblAjax;
    var __r = [func, lblAjax];
    return __r;
};
function __JSONLoader_initialize() {
    if(__JSONLoader.__was_initialized__) return;
    __JSONLoader.__was_initialized__ = true;
    if(!__AjaxLoader.__was_initialized__)
        __AjaxLoader_initialize();
    pyjs_extend(__JSONLoader, __AjaxLoader);
    __JSONLoader.prototype.__class__.__new__ = JSONLoader;
    __JSONLoader.prototype.__init__ = function(func, lblAjax) {
    if (typeof lblAjax == 'undefined') lblAjax=null;
    this.func = func;
    __AjaxLoader.prototype.__class__.__init__(this, lblAjax);
    };
__JSONLoader.prototype.__init__.parse_kwargs = function ( __kwargs, func, lblAjax ) {
    if (typeof lblAjax == 'undefined')
        lblAjax=__kwargs.lblAjax;
    var __r = [func, lblAjax];
    return __r;
};
    __JSONLoader.prototype.__class__.__init__ = function() {
        return __JSONLoader.prototype.__init__.call.apply(__JSONLoader.prototype.__init__, arguments);
    };
    __JSONLoader.prototype.__class__.__init__.unbound_method = true;
    __JSONLoader.prototype.__init__.instance_method = true;
    __JSONLoader.prototype.__class__.__init__.parse_kwargs = __JSONLoader.prototype.__init__.parse_kwargs;
    __JSONLoader.prototype.onCompletion = function(text) {
    __AjaxLoader.prototype.__class__.onCompletion(this, text);
    this.func(text);
    };
    __JSONLoader.prototype.__class__.onCompletion = function() {
        return __JSONLoader.prototype.onCompletion.call.apply(__JSONLoader.prototype.onCompletion, arguments);
    };
    __JSONLoader.prototype.__class__.onCompletion.unbound_method = true;
    __JSONLoader.prototype.onCompletion.instance_method = true;
}
function __MenuCmd() {
}
function MenuCmd(object, handler) {
    var instance = new __MenuCmd();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __MenuCmd_initialize() {
    if(__MenuCmd.__was_initialized__) return;
    __MenuCmd.__was_initialized__ = true;
    pyjs_extend(__MenuCmd, __pyjslib_Object);
    __MenuCmd.prototype.__class__.__new__ = MenuCmd;
    __MenuCmd.prototype.__init__ = function(object, handler) {
    this._object = object;
    this._handler = handler;
    };
    __MenuCmd.prototype.__class__.__init__ = function() {
        return __MenuCmd.prototype.__init__.call.apply(__MenuCmd.prototype.__init__, arguments);
    };
    __MenuCmd.prototype.__class__.__init__.unbound_method = true;
    __MenuCmd.prototype.__init__.instance_method = true;
    __MenuCmd.prototype.execute = function() {
    var handler = pyjslib_getattr(this._object, this._handler);
    handler();
    };
    __MenuCmd.prototype.__class__.execute = function() {
        return __MenuCmd.prototype.execute.call.apply(__MenuCmd.prototype.execute, arguments);
    };
    __MenuCmd.prototype.__class__.execute.unbound_method = true;
    __MenuCmd.prototype.execute.instance_method = true;
}
function __FormAbout() {
}
function FormAbout(title, autoHide) {
    if (typeof title == 'undefined') title='About...';
    if (typeof autoHide == 'undefined') autoHide=null;
    var instance = new __FormAbout();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


FormAbout.parse_kwargs = function ( __kwargs, title, autoHide ) {
    if (typeof title == 'undefined')
        title=__kwargs.title;
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    var __r = [title, autoHide];
    return __r;
};
function __FormAbout_initialize() {
    if(__FormAbout.__was_initialized__) return;
    __FormAbout.__was_initialized__ = true;
    if(!__ui_DialogBox.__was_initialized__)
        __ui_DialogBox_initialize();
    pyjs_extend(__FormAbout, __ui_DialogBox);
    __FormAbout.prototype.__class__.__new__ = FormAbout;
    __FormAbout.prototype.__init__ = function(title, autoHide) {
    if (typeof title == 'undefined') title='About...';
    if (typeof autoHide == 'undefined') autoHide=null;
    __ui_DialogBox.prototype.__class__.__init__(this, autoHide);
    this.setHTML(title);
    DOM_setStyleAttribute(this.getElement(), 'backgroundColor', '#E7E7E7');
    DOM_setStyleAttribute(this.caption.getElement(), 'backgroundColor', '#0D4B70');
    DOM_setStyleAttribute(this.caption.getElement(), 'color', '#FFFFFF');
    var panel = ui_VerticalPanel();
    DOM_setStyleAttribute(panel.getElement(), 'backgroundColor', '#E7E7E7');
    panel.setHorizontalAlignment('center');
    panel.add(pyjs_kwargs_function_call(ui_Frame, [{url:'about.html'}]));
    panel.add(ui_HTML('<div style="background-color: #e7e7e7;">&nbsp;</div>'));
    var btnok = ui_Label('OK');
    btnok.addMouseListener(Tooltip_TooltipListener('Cerrar'));
    btnok.addClickListener(this);
    btnok.setStyleName('tooltip');
    DOM_setStyleAttribute(btnok.getElement(), 'cursor', 'pointer');
    DOM_setStyleAttribute(btnok.getElement(), 'backgroundColor', '#E7E7E7');
    DOM_setStyleAttribute(btnok.getElement(), 'width', '40px');
    DOM_setStyleAttribute(btnok.getElement(), 'verticalAlign', 'middle');
    panel.add(btnok);
    this.setWidget(panel);
    };
__FormAbout.prototype.__init__.parse_kwargs = function ( __kwargs, title, autoHide ) {
    if (typeof title == 'undefined')
        title=__kwargs.title;
    if (typeof autoHide == 'undefined')
        autoHide=__kwargs.autoHide;
    var __r = [title, autoHide];
    return __r;
};
    __FormAbout.prototype.__class__.__init__ = function() {
        return __FormAbout.prototype.__init__.call.apply(__FormAbout.prototype.__init__, arguments);
    };
    __FormAbout.prototype.__class__.__init__.unbound_method = true;
    __FormAbout.prototype.__init__.instance_method = true;
    __FormAbout.prototype.__class__.__init__.parse_kwargs = __FormAbout.prototype.__init__.parse_kwargs;
    __FormAbout.prototype.onClick = function() {
    this.hide();
    };
    __FormAbout.prototype.__class__.onClick = function() {
        return __FormAbout.prototype.onClick.call.apply(__FormAbout.prototype.onClick, arguments);
    };
    __FormAbout.prototype.__class__.onClick.unbound_method = true;
    __FormAbout.prototype.onClick.instance_method = true;
}
function __index() {
}
function index() {
    var instance = new __index();
    if(instance.__init__) instance.__init__.apply(instance, arguments);
    return instance;
}


function __index_initialize() {
    if(__index.__was_initialized__) return;
    __index.__was_initialized__ = true;
    pyjs_extend(__index, __pyjslib_Object);
    __index.prototype.__class__.__new__ = index;
    __index.prototype.onModuleLoad = function() {
    this.frmAbout = pyjs_kwargs_function_call(FormAbout, [{autoHide:true}]);
function fakeMouseMove(self, x, y) {
}


    this.frmAbout.onMouseMove = fakeMouseMove;
    this.frmAbout.setWidth(305);
    this.frmAbout.setHeight(250);
    var left =  (  ( Window_getClientWidth() - 305 )  / 2 ) ;
    var top =  (  ( Window_getClientHeight() - 250 )  / 2 ) ;
    this.frmAbout.setPopupPosition(left, top);
    this.lblAjax = ui_HTML('\n                            <div style="position: absolute; right: 10px; top: 10px; color: #fff;\n                            background-color: inherit;">\n                            <img src="images/waiting2.gif"/>\n                            </div>\n                            ');
    this.lblAjax.setVisible(false);
    var roundPanel = Widgets_RoundPanel('<div style="padding-top: 1em; padding-left: 1em; padding-bottom: 5em;\n                                padding-right: 2em;"\n                                id="central">\n                                </div>');
    DOM_setStyleAttribute(roundPanel.getElement(), 'position', 'absolute');
    DOM_setStyleAttribute(roundPanel.getElement(), 'top', '10%');
    DOM_setStyleAttribute(roundPanel.getElement(), 'left', '10%');
    DOM_setStyleAttribute(roundPanel.getElement(), 'width', '80%');
    this.centralPanel = ui_HTMLPanel('<div id="menuDiv"></div><p></p><p></p><p></p>\n                                      <div style="text-align: center;" id="clockDiv"></div>');
    roundPanel.add(this.centralPanel, 'central');
    var simple = ui_SimplePanel();
    this.centralPanel.add(simple, 'menuDiv');
    var menuFiles = pyjs_kwargs_function_call(ui_MenuBar, [{vertical:true}]);
    menuFiles.addItem('Open', MenuCmd(this, 'onMenuOpen'));
    menuFiles.addItem('Exit', MenuCmd(this, 'onMenuExit'));
    var menuFuncs = pyjs_kwargs_function_call(ui_MenuBar, [{vertical:true}]);
    menuFuncs.addItem('C.R.U.D. Example', MenuCmd(this, 'onMenuFunction1'));
    menuFuncs.addItem('Function 2 - Show Tabbed Dialog', MenuCmd(this, 'onMenuFunction2'));
    var menuHelp = pyjs_kwargs_function_call(ui_MenuBar, [{vertical:true}]);
    menuHelp.addItem('Help', MenuCmd(this, 'onMenuHelp'));
    menuHelp.addItem('About', MenuCmd(this, 'onMenuAbout'));
    var menubar = pyjs_kwargs_function_call(ui_MenuBar, [{vertical:false}]);
    menubar.addItem(ui_MenuItem('Files', menuFiles));
    menubar.addItem(ui_MenuItem('Functions', menuFuncs));
    menubar.addItem(ui_MenuItem('<strong>Help</strong>', true, menuHelp));
    simple.add(menubar);
    var img_url = 'images/clock.png';
    this.solar = Widgets_SolarCanvas(img_url);
    this.solar.isActive = true;
    this.centralPanel.add(this.solar, 'clockDiv');
    ui_RootPanel().add(roundPanel);
    ui_RootPanel().add(this.lblAjax);
    this.createDialog1();
    this.createDialog2();
    };
    __index.prototype.__class__.onModuleLoad = function() {
        return __index.prototype.onModuleLoad.call.apply(__index.prototype.onModuleLoad, arguments);
    };
    __index.prototype.__class__.onModuleLoad.unbound_method = true;
    __index.prototype.onModuleLoad.instance_method = true;
    __index.prototype.showDialog1 = function() {
    this._dialog1.show();
    };
    __index.prototype.__class__.showDialog1 = function() {
        return __index.prototype.showDialog1.call.apply(__index.prototype.showDialog1, arguments);
    };
    __index.prototype.__class__.showDialog1.unbound_method = true;
    __index.prototype.showDialog1.instance_method = true;
    __index.prototype.createDialog1 = function() {
    this._dialog1 = pyjs_kwargs_function_call(ui_DialogBox, [{autoHide:true}]);
    this._dialog1.setHTML('ABM Afiliados');
    var field0 = new pyjslib_Dict([['colName', 'id'], ['colRepr', 'Id'], ['isId', true], ['isVisible', false], ['colValue', '0']]);
    var field1 = new pyjslib_Dict([['colName', 'nombre'], ['colRepr', 'Nombre'], ['isId', false], ['isVisible', true], ['colValue', '']]);
    var field2 = new pyjslib_Dict([['colName', 'fechanac'], ['colRepr', 'Nacimiento'], ['isId', false], ['isVisible', true], ['colValue', '']]);
    this.crudPanel = pyjs_kwargs_function_call(dbwidgets_CrudPanel, [{tableName:'afiliados', fields:new pyjslib_List([field0, field1, field2]), labelAjax:this.lblAjax}]);
    this._dialog1.setWidget(this.crudPanel);
    var left = 150;
    var top = 120;
    this._dialog1.setPopupPosition(left, top);
    };
    __index.prototype.__class__.createDialog1 = function() {
        return __index.prototype.createDialog1.call.apply(__index.prototype.createDialog1, arguments);
    };
    __index.prototype.__class__.createDialog1.unbound_method = true;
    __index.prototype.createDialog1.instance_method = true;
    __index.prototype.showCountryData = function() {
    var stri = '';
    stri +=  (  ( 'Country: ' + this.countrylist.getItemText(this.countrylist.getSelectedIndex()) )  + '\n' ) ;
    stri +=  ( 'Code: ' + this.countrylist.getValue(this.countrylist.getSelectedIndex()) ) ;
    Window_alert(stri);
    };
    __index.prototype.__class__.showCountryData = function() {
        return __index.prototype.showCountryData.call.apply(__index.prototype.showCountryData, arguments);
    };
    __index.prototype.__class__.showCountryData.unbound_method = true;
    __index.prototype.showCountryData.instance_method = true;
    __index.prototype.showDialog2 = function() {
    this._dialog2.show();
    };
    __index.prototype.__class__.showDialog2 = function() {
        return __index.prototype.showDialog2.call.apply(__index.prototype.showDialog2, arguments);
    };
    __index.prototype.__class__.showDialog2.unbound_method = true;
    __index.prototype.showDialog2.instance_method = true;
    __index.prototype.createDialog2 = function() {
    var contents = ui_VerticalPanel();
    contents.setSpacing(4);
    var tabs = ui_TabPanel();
    tabs.add(ui_HTML('The quick brown fox jumps over the lazy dog.'), 'Tab 1');
    tabs.add(ui_HTML('The early bird catches the worm.'), 'Tab 2');
    tabs.add(ui_HTML('The smart money is on the black horse.'), 'Tab 3');
    this.countrylist = CountryListBox_CountryListBox();
    this.countrylist.setSelectedIndex(11);
    this.countrylist.setVisibleItemCount(10);
    this.countrylist.addChangeListener(pyjslib_getattr(this, 'showCountryData'));
    tabs.add(this.countrylist, 'Country List');
    var ac = AutoComplete_AutoCompleteTextBox();
    var equipos = new pyjslib_List(['River Plate', 'Boca Juniors', 'Tiro Federal', 'Newell\'s Old Boys', 'Rosario Central', 'San Lorenzo', 'Hurac\xc3\xa1n', 'Racing Club', 'Independiente', 'San Mart\xc3\xadn', 'Estudiantes', 'Gimnasia y Esgrima', 'Col\xc3\xb3nVelez Sarsfield']);
    ac.setCompletionItems(equipos);
    tabs.add(ac, 'Equipos');
    tabs.selectTab(3);
    tabs.setWidth('300px');
    tabs.setHeight('100px');
    contents.add(tabs);
    contents.add(ui_Button('Close', pyjslib_getattr(this, 'onCloseDialog2')));
    contents.setStyleName('Contents');
    this._dialog2 = ui_DialogBox();
    this._dialog2.setHTML('<b style="color: navy;">Tabbed Dialog Demo</b>');
    this._dialog2.setWidget(contents);
    var left =  (  ( Window_getClientWidth() - 300 )  / 2 ) ;
    var top =  (  (  ( Window_getClientHeight() - 100 )  / 2 )  - 100 ) ;
    this._dialog2.setPopupPosition(left, top);
    };
    __index.prototype.__class__.createDialog2 = function() {
        return __index.prototype.createDialog2.call.apply(__index.prototype.createDialog2, arguments);
    };
    __index.prototype.__class__.createDialog2.unbound_method = true;
    __index.prototype.createDialog2.instance_method = true;
    __index.prototype.onCloseDialog2 = function() {
    this._dialog2.hide();
    };
    __index.prototype.__class__.onCloseDialog2 = function() {
        return __index.prototype.onCloseDialog2.call.apply(__index.prototype.onCloseDialog2, arguments);
    };
    __index.prototype.__class__.onCloseDialog2.unbound_method = true;
    __index.prototype.onCloseDialog2.instance_method = true;
    __index.prototype.onMenuOpen = function() {
    Window_alert('Open');
    };
    __index.prototype.__class__.onMenuOpen = function() {
        return __index.prototype.onMenuOpen.call.apply(__index.prototype.onMenuOpen, arguments);
    };
    __index.prototype.__class__.onMenuOpen.unbound_method = true;
    __index.prototype.onMenuOpen.instance_method = true;
    __index.prototype.onMenuExit = function() {
    Window_alert('Exit');
window.close();
    };
    __index.prototype.__class__.onMenuExit = function() {
        return __index.prototype.onMenuExit.call.apply(__index.prototype.onMenuExit, arguments);
    };
    __index.prototype.__class__.onMenuExit.unbound_method = true;
    __index.prototype.onMenuExit.instance_method = true;
    __index.prototype.onMenuHelp = function() {
    Window_alert('Help');
    };
    __index.prototype.__class__.onMenuHelp = function() {
        return __index.prototype.onMenuHelp.call.apply(__index.prototype.onMenuHelp, arguments);
    };
    __index.prototype.__class__.onMenuHelp.unbound_method = true;
    __index.prototype.onMenuHelp.instance_method = true;
    __index.prototype.onMenuAbout = function() {
    this.frmAbout.show();
    };
    __index.prototype.__class__.onMenuAbout = function() {
        return __index.prototype.onMenuAbout.call.apply(__index.prototype.onMenuAbout, arguments);
    };
    __index.prototype.__class__.onMenuAbout.unbound_method = true;
    __index.prototype.onMenuAbout.instance_method = true;
    __index.prototype.onMenuFunction1 = function() {
    this.crudPanel.requestList();
    this.showDialog1();
    };
    __index.prototype.__class__.onMenuFunction1 = function() {
        return __index.prototype.onMenuFunction1.call.apply(__index.prototype.onMenuFunction1, arguments);
    };
    __index.prototype.__class__.onMenuFunction1.unbound_method = true;
    __index.prototype.onMenuFunction1.instance_method = true;
    __index.prototype.onMenuFunction2 = function() {
    this.showDialog2();
    };
    __index.prototype.__class__.onMenuFunction2 = function() {
        return __index.prototype.onMenuFunction2.call.apply(__index.prototype.onMenuFunction2, arguments);
    };
    __index.prototype.__class__.onMenuFunction2.unbound_method = true;
    __index.prototype.onMenuFunction2.instance_method = true;
}
__MenuCmd_initialize();
__index_initialize();
__HTMLLoader_initialize();
__AjaxLoader_initialize();
__FormAbout_initialize();
__JSONLoader_initialize();


function run() {
    app = new index();
    app.onModuleLoad();
}

function pygwtOnLoad(onLoadError, name) {
    if (onLoadError)
        try {
            run();
        } catch (exception) {
            onLoadError(name);
        }
    else {
            run();
    }
}

--></script>
</body>
</html>

